|
Home > Online Product Documentation > Table of Contents > Accessing Other Documents During Query Execution Accessing Other Documents During Query Execution
During execution of a query, you might want to access data in another document. To do this, call the
This section discusses the following topics: Format of the document() Function
To query multiple documents with a single query, call the
The format for the
The XPath processor examines the first argument. If it is a single value (that is, it is not a node set) the XPath processor converts it to a string, if it is not already a string. Separate directory names and the file name with a forward slash (/). See the following format:
This string must be an absolute path. The XPath processor retrieves the specified document. The new context node is the root node of this document. Suppose you invoke the
When the First Argument is a Node Set
It is possible for the first argument of the
Specification of Second ArgumentIf you specify a second argument, it must be a node set. The XPath processor examines the first node (in the context of document order) in the node set to determine the document that this node belongs to. The XPath processor retrieves the name of the directory that contains this document and appends the relative path from the first argument to the name of the directory. This creates an absolute path, and the XPath processor retrieves the specified document. If there is no second argument, the query must be an expression in an XSLT stylesheet. The XPath processor appends the relative path to the name of the directory that contains the XSLT stylesheet. This allows the query to examine the stylesheet itself. Example of Calling the document() FunctionSuppose you have the following XML document:
The following query returns the
Now suppose you pass this query to the
This query returns the root nodes of
|

Cart

