XPath - Quering two XML documents

Posted by Arnej65 on Stack Overflow See other posts from Stack Overflow or by Arnej65
Published on 2010-05-25T12:35:13Z Indexed on 2010/05/25 12:41 UTC
Read the original article Hit count: 355

Filed under:
|

I have have two xml docs:

XML1:

<Books>
     <Book id="11">
          .......
          <AuthorName/>
     </Book>
     ......
</Books>

XML2:

<Authors>
     <Author>
          <BookId>11</BookId>
          <AuthorName>Smith</AuthorName>
     </Author>
</Authors>

I'm trying to do the following:

Get the value of XML2/Author/AuthorName where XML1/Book/@id equals XML2/Author/BookId.

XML2/Author/AuthorName[../BookId = XML1/Book/@id]

© Stack Overflow or respective owner

Related posts about xpath

Related posts about xpath-expression