xquery on elements with attribute named 'type'

K

kishjeff

Hi.

I would like to find all elements of type 'tab' that have an attribute
named 'type' and also that the type attribute is not called 'list'.

I've tried this but it won't compile by my xquery interpreter (a
little long in the tooth I'm afraid)

for $doc in collection('c:\myxml')
for $a in $doc //tab[(@type)]
return
<Atable> tokenize({base-uri($a)},{data($a/@beanclass)},{node-name($a)},
{$a}</Atable>


So it might find this tab element:
<big id='aaa' >
<tab id='bbb' type='newtype' />
</big

but not these tab elements:

<big id='aaa' >
<tab id='bbb' type='list' />
<tab id='ccc' />
</big



Also finally, one last question.. base-uri is not returning the name
of the xml file, just the path part. How can I get that also so I know
what file it was in?

regards
Jeff
 
M

Martin Honnen

kishjeff said:
I would like to find all elements of type 'tab' that have an attribute
named 'type' and also that the type attribute is not called 'list'.

doc('file.xml')//tab[@type and @type ne 'list']

I've tried this but it won't compile by my xquery interpreter (a
little long in the tooth I'm afraid)

for $doc in collection('c:\myxml')
for $a in $doc //tab[(@type)]
return
<Atable> tokenize({base-uri($a)},{data($a/@beanclass)},{node-name($a)},
{$a}</Atable>

What do you want to do with the tokenize function?
 
K

kishjeff

kishjeff said:
I would like to find all elements of type 'tab' that have an attribute
named 'type' and also that the type attribute is not called 'list'.

  doc('file.xml')//tab[@type and @type ne 'list']

I'm afraid that the @type isn't compiling in my xquery machine I have
at my disposal.
I guess I'll have to get something else to work in its stead. too bad
it has a nice gui
front end... unless there is another way?
I've tried this but it won't compile by my xquery interpreter (a
little long in the tooth I'm afraid)
for $doc in collection('c:\myxml')
for $a in $doc //tab[(@type)]
return
<Atable> tokenize({base-uri($a)},{data($a/@beanclass)},{node-name($a)},
{$a}</Atable>

What do you want to do with the tokenize function?
Get the name of the xml file (out of the collection of xml files) that
the result came from
Thanks again
Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top