how do I query this?

Discussion in 'XML' started by Mike Kamermans, Sep 16, 2006.

  1. hi,

    I have the following xml element in a document:

    <node name="thisnodename">
    <links>
    <linkto nodename="somenodename"/>
    ...
    </links>
    ...
    </node>

    and I want to, given a variable $nodename, find all nodes that link to
    it.
    Is there a single xquery that will let me do this? I'm stuck at the fact
    that:

    "//node/links/linkto[@nodename=$nodename]"

    will only give back a /linkto nodeset ... =/

    - Mike Kamermans
    Mike Kamermans, Sep 16, 2006
    #1
    1. Advertising

  2. Mike Kamermans wrote:


    > "//node/links/linkto[@nodename=$nodename]"
    >
    > will only give back a /linkto nodeset ... =/


    If you are looking for node elements then put the rest into a predicate e.g.
    //node[links/linkto[@nodename=$nodename]]

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Sep 16, 2006
    #2
    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. Learner
    Replies:
    1
    Views:
    984
    Marina Levit [MVP]
    Jan 30, 2006
  2. Anonymous
    Replies:
    0
    Views:
    1,457
    Anonymous
    Oct 13, 2005
  3. David Gordon

    xpath query query

    David Gordon, May 18, 2005, in forum: XML
    Replies:
    2
    Views:
    787
    David Gordon
    May 18, 2005
  4. Eric Nelson
    Replies:
    5
    Views:
    1,525
    Alexey Smirnov
    Feb 4, 2009
  5. Jon F.

    CAML Query: Multiple Query Fields Issue

    Jon F., May 12, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    754
    Jon F.
    May 12, 2004
Loading...

Share This Page