Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 818959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:13:50+00:00 2026-05-15T02:13:50+00:00

I have have two xml docs: XML1: <Books> <Book id=11> ……. <AuthorName/> </Book> ……

  • 0

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]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:13:51+00:00Added an answer on May 15, 2026 at 2:13 am

    An XPath 1.0 expression cannot refer to more than one XML document, unless the references to the additional documents have been set up in the context of the XPath engine by the hosting language. For example, if XSLT is the hosting language, then it makes its document() function available to the XPath engine it is hosting.

    document($xml2Uri)/Authors/Author[BookId = $mainDoc/Books/Book/@id]
    

    Do note, that even the main XML document needs to be referenced via another <xsl:variable>, named here $mainDoc.

    The document() function is available only if Xpath is hosted by XSLT! This is not mentioned in the answer of Doc Brown and is misleading the readers.

    An XPath 2.x expression may refer to any additional XML document using the XPath 2.0 doc() function.

    for $doc  in /,
        $doc2 in doc(someUri)
      return
        $doc2/Authors/Author[BookId = $doc/Books/Book/@id]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two XML docs that I've created and I want to combine these
I have two XML files with two different XSD schemas and different namespaces. They
I have two XML files. They are similar, but there are two nodes of
I have two applications written in Java that communicate with each other using XML
Are there any tools to effectively compare two XML schema's? I have seen some
I have parsed XML using both of the following two methods... Parsing the XmlDocument
I have an xml file like this: <root> <item> <name>one</name> <status>good</status> </item> <item> <name>two</name>
I have two XML Schemas. First ( A.xsd ) is located in a library
I have two XML examples that I want to write a schema for: Example
I obviously new and have been trying to two days to figure out how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.