Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > xquery on elements with attribute named 'type'

Reply
Thread Tools

xquery on elements with attribute named 'type'

 
 
kishjeff
Guest
Posts: n/a
 
      12-16-2008
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
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-16-2008
kishjeff wrote:

> 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?

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
kishjeff
Guest
Posts: n/a
 
      12-17-2008
On Dec 16, 10:56*am, Martin Honnen <mahotr...@yahoo.de> wrote:
> kishjeff wrote:
> > 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
>
> --
>
> * * * * Martin Honnen
> * * * *http://JavaScript.FAQTs.com/


Thanks again
Jeff

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Xquery attribute value test with wildcard jule XML 2 07-17-2011 04:25 PM
obtain element name, or attribute and value of the document name itself, and some elemnts and attributes from an ancestor or the node itself using xquery Jeff Kish XML 4 10-30-2008 05:47 PM
picking value of one attribute based on a child elements attribute? XPath? vjethava@gmail.com XML 2 03-06-2006 05:19 AM
Xquery, repeating elements, Sleepycat's DB XML Bob XML 0 11-16-2005 05:37 AM
xquery question.. how 2 if possible get tuples that have any attributes or elements of a given value Jeff Kish XML 11 10-21-2004 01:56 AM



Advertisments