Re: [xsl] Transforming multiple XML files into one file

Subject: Re: [xsl] Transforming multiple XML files into one file
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 03 Jul 2006 17:08:54 -0400
Chad,

Since David's probably getting some well-earned sleep (or maybe not, with the mini-David to take care of) --

At 03:31 PM 7/3/2006, you wrote:
David,
How does the XSLT know the exact location of the files that you are
listing. Do they need to be located in the same directory?

This depends on how you call document(). The function takes a second argument, identifying a node relative to which the URL is dereferenced. So


document('file.xml',/)

finds file.xml next to the XML entity in which the root node of the source document is found.

This defaults to work relative to the stylesheet.

The values of the nodes you give to document($nodes) can contain relative URLs if you like:

<list>
<file>file1.xml</file>
<file>../dir2/file2.xml</file>
<file>http://w3.org/find/me/here.xml</file>
</list>

calling document(file,.) from the context of the list element will find documents relative to the location of the list element, "." (or rather, of the XML entity in which the list element appears). So file1.xml should be next to this source document, file2.xml will be in the dir2 directory over one in the same file system, and the third document will be on the W3C web site....

I hope that helps,
Wendell

Current Thread