This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: two xml source documents


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]