|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: combining 2 different XML files within the same XS
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








