Subject: Re: [xsl] combining 2 different XML files within the same XSLT From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 29 Aug 2002 12:04:09 +0100 |
Hi Todd, > when using the document(//file) to fill the $mergedset variable, I > am not allowed to have file paths in front of the files > > <files> > <file>games.xml</file> > <file>events.xml</file> > </files> > > so the XML files have to be in the same directory as the XSL file, > not a huge deal, but I usually keep all the XML files in a separate > directory (cgi-bin/xml) from the XSL files.. > > so what I would like is > <files> > <file>cgi-bin/xml/ncaa_games.xml</file> > <file>cgi-bin/xml/holidays.xml</file> > </files> > > but IF I do that, this doesn't work > <xsl:variable name="mergedset" select="document(//file)"/> The secret is the second argument of document(). When you use the document() function with a single argument, then it takes the URIs you specify and resolves them (as you've found) relative to the *stylesheet*. If you specify a node as the second argument, then it finds the base URI of the node (which is the URI of the file in which the node lives, usually), and uses that as the base URI for resolving the relative filenames. So, move your files.xml into the XML directory along with the other XML files, and use relative paths from the files.xml file to these other files: <files> <file>games.xml</file> <file>events.xml</file> </files> Then use the second argument in the document() function so that the filenames are resolved relative to the location of files.xml rather than to the stylesheet: <xsl:variable name="mergedset" select="document(//file, /)"/> and all should be well (I think!). Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] combining 2 different XML, todd binder | Thread | [xsl] Mail Merge problem, James Carlyle |
RE: [xsl] preceding-sibling reverse, TSchutzerWeissmann | Date | [xsl] another quest, Alia Mikati |
Month |