This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: two xml source documents
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "Charles Knell" <cknell at onebox dot com>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Thu, 1 Aug 2002 18:23:59 +0100
- Subject: Re: [xsl] two xml source documents
- Organization: Jeni Tennison Consulting Ltd
- References: <20020801165830.BFSK1160.mta08.onebox.com@onebox.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Charles,
> From The XSLT Programmer's Reference 2nd Edition, pg. 466, strictly
> speaking the first parameter is a URI which in my case is a file
> name and the second parameter is the base-uri which is used to
> resolve any relative reference contained in the first parameter.
It's not quite that simple: the second argument to the document()
function is a *node-set* and the base URI (used to resolve the first
argument) is the base URI of the first node in that node set. The base
URI of a node is the location in which it originated. Usually you'd
pass the context node as the second argument, something like:
<xsl:template match="xi:include">
<xsl:copy-of select="document(@href, .)" />
</xsl:template>
to ensure that the first argument is resolved relative to the XML
document in which the URI is specified rather than relative to the
stylesheet itself.
I'm very surprised that:
document('contractorList.xml', '../xml/')
works for you. I get errors when I try using that with Saxon, MSXML or
Xalan-J...
(Also, the first argument can be a node-set rather than a URI, in
which case you get a node-set containing all the root nodes of all the
documents referenced.)
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list