xquery on elements with attribute named 'type'

kishjeff

Usenet Archive
Joined
Oct 10, 2008
Messages
10
Reaction score
0
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
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
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?
 

kishjeff

Usenet Archive
Joined
Oct 10, 2008
Messages
10
Reaction score
0
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
548,049
Messages
3,104,243
Members
248,133
Latest member
DujonT

Latest Threads

Top