Results 1 to 2 of 2

Thread: [Resolved]Xpath

  1. #1

    Thread Starter
    Addicted Member Martin Wilson's Avatar
    Join Date
    Mar 2002
    Location
    :)
    Posts
    236

    [Resolved]Xpath

    hey, sorry for the non-descriptive subject, but this really can't be described in a few words or i'd have used google :-)
    ok...given this XML as a simplified example:
    Code:
    <a>
         <b>x</b>
         <c>1</c>
    </a>
    <a>
         <b>y</b>
         <c>2</c>
    </a>
    <a>
         <b>z</b>
         <c>3</c>
    </a>
    
    <d>
         <b>y</b>
    </d>
    For each d element, I want the value of c in the a element with a matching value of b.

    Got that?

    tia
    -Martin
    Last edited by Martin Wilson; Mar 15th, 2004 at 07:07 PM.
    What is the answer to this question?

  2. #2

    Thread Starter
    Addicted Member Martin Wilson's Avatar
    Join Date
    Mar 2002
    Location
    :)
    Posts
    236
    Fixed it my self, for those that want to know...

    add something like:
    <xsl:key name='a-search' match='a' use='b' />
    before the <xsl:stylesheet> element.

    then the XPath is:

    key('a-search', b)/c


    hope that helps someone

    -Martin
    What is the answer to this question?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width