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

  • SEARCH
  • Home
  • 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 115715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:03:49+00:00 2026-05-11T03:03:49+00:00

Is it possible to open 2 documents from an xQuery and do a join

  • 0

Is it possible to open 2 documents from an xQuery and do a join on them?

  • 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. 2026-05-11T03:03:49+00:00Added an answer on May 11, 2026 at 3:03 am

    Yes, here is an example from the XQuery spec.:

    ‘Joins, which combine data from multiple sources into a single result, are a very important type of query. In this section we will illustrate how several types of joins can be expressed in XQuery. We will base our examples on the following three documents:

    1. A document named parts.xml that contains many part elements; each part element in turn contains partno and description subelements.
    2. A document named suppliers.xml that contains many supplier elements; each supplier element in turn contains suppno and suppname subelements.
    3. A document named catalog.xml that contains information about the relationships between suppliers and parts. The catalog document contains many item elements, each of which in turn contains partno, suppno, and price subelements.

    A conventional (‘inner’) join returns information from two or more related sources, as illustrated by the following example, which combines information from three documents. The example generates a ‘descriptive catalog’ derived from the catalog document, but containing part descriptions instead of part numbers and supplier names instead of supplier numbers. The new catalog is ordered alphabetically by part description and secondarily by supplier name.*

    <descriptive-catalog>    {       for $i in fn:doc('catalog.xml')/items/item,          $p in fn:doc('parts.xml')/parts/part[partno = $i/partno],          $s in fn:doc('suppliers.xml')/suppliers                   /supplier[suppno = $i/suppno]      order by $p/description, $s/suppname      return         <item>            {            $p/description,            $s/suppname,            $i/price            }         </item>    } </descriptive-catalog> 

    The previous query returns information only about parts that have suppliers and suppliers that have parts. An outer join is a join that preserves information from one or more of the participating sources, including elements that have no matching element in the other source. For example, a left outer join between suppliers and parts might return information about suppliers that have no matching parts.’

    Do note that XQuery does not have a standard document() function (it is an XSLT function) and instead has the doc() function, which is part of the ‘XQuery 1.0 and XPath 2.0 Functions and Operators‘.

    There are at least two errors in the answer by Chris:

    1. XQuery is case sensitive — the capitalised keywords used in Chris’ example will not be allowed by a conforming XQuery processor.
    2. It is not necessary to prefix the standard functions like doc(), I am just quoting the XQuery spec, which has the prefix. Otherwise, in my own code I would omit the ‘fn‘ prefix.
    3. The function document() is not a standard XQuery/XPath function. The doc() function should be used instead.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 187k
  • Answers 187k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's not true that vim doesn't have internal capabilities to… May 12, 2026 at 5:28 pm
  • Editorial Team
    Editorial Team added an answer I also used the params[:commit] method on a form already.… May 12, 2026 at 5:28 pm
  • Editorial Team
    Editorial Team added an answer Well, consider the following: Is your server fast? - if… May 12, 2026 at 5:28 pm

Related Questions

I'm thinking about starting work on a fairly large scale .NET or ASP.NET project
Is it possible give full trust, programmatically to an ActiveX control embedded in a
I need to have the ability to convert and merge various documents into a
I have a WCF service that does some document conversions and returns the document

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.