xquery on elements with attribute named 'type'

Discussion in 'XML' started by kishjeff, Dec 16, 2008.

  1. kishjeff

    kishjeff Guest

    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
    kishjeff, Dec 16, 2008
    #1
    1. Advertising

  2. 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/
    Martin Honnen, Dec 16, 2008
    #2
    1. Advertising

  3. kishjeff

    kishjeff Guest

    On Dec 16, 10:56 am, Martin Honnen <> 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
    kishjeff, Dec 17, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brunswick
    Replies:
    1
    Views:
    381
    Toni Uusitalo
    Jan 27, 2004
  2. Jeff Kish
    Replies:
    11
    Views:
    796
    Jeff Kish
    Oct 21, 2004
  3. Stanimir Stamenkov
    Replies:
    9
    Views:
    1,007
    David Carlisle
    Jan 26, 2005
  4. Bob
    Replies:
    1
    Views:
    1,258
    Mark Fitzpatrick
    Feb 8, 2008
  5. jule
    Replies:
    2
    Views:
    1,736
    Martin Honnen
    Jul 17, 2011
Loading...

Share This Page