Format of the document() Function

To query multiple documents with a single query, call the document() function in a query. During execution of a query on a particular document, this function allows you to access another XML document.

The format for the document() function is

node-set document(object, node-set?)
               

            

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 document() function and the requested document does not exist. If the invocation is in a stylesheet, the XPath processor returns an empty node set. If the invocation is anywhere else, the XPath processor returns an error message.

 
Free Stylus Studio XML Training: