From: Mark Diggory <mdiggory@la...> - 2002-03-02 20:50:02
I'm struggling with the document function.
If I understand correctly from the spec. can't I resolve a document
relative to the xsl I'm working in. I.E.
the url of the xsl document:
the url of the xml document.
I thought that
<xsl:param name="Outline" select="document('classif.xml')/node()"/>
would give me the document, but this doesn't seem so (at least with Saxon).
Am I missing something?
12.1 Multiple Source Documents
Function: node-set document(object, node-set?)
When the first argument to the document function is not a node-set, the
first argument is converted to a string as if by a call to the string
function. This string is treated as a URI reference; the resource
identified by the URI is retrieved. The data resulting from the
retrieval action is parsed as an XML document and a tree is constructed
in accordance with the data model (see [3 Data Model]). If there is an
error retrieving the resource, then the XSLT processor may signal an
error; if it does not signal an error, it must recover by returning an
empty node-set. One possible kind of retrieval error is that the XSLT
processor does not support the URI scheme used by the URI. An XSLT
processor is not required to support any particular URI schemes. The
documentation for an XSLT processor should specify which URI schemes the
XSLT processor supports.
The URI reference may be relative. The base URI (see [3.2 Base URI]) of
the node in the second argument node-set that is first in document order
is used as the base URI for resolving the relative URI into an absolute
URI. If the second argument is omitted, then it defaults to the node in
the stylesheet that contains the expression that includes the call to
the document function. Note that a zero-length URI reference is a
reference to the document relative to which the URI reference is being
resolved; thus document("") refers to the root node of the stylesheet;
the tree representation of the stylesheet is exactly the same as if the
XML document containing the stylesheet was the initial source document.