Subject: RE: document() for opening multiple documents
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 9 Jul 2003 14:16:22 +0100
|
The base URI for nodes in a result tree fragment is the base URI of the
stylesheet (more strictly, the base URI of the xsl:variable element used
to construct the RTF.)
This may be a case where you want to use the second argument of the
document() function to supply a base URI more precisely.
Michael Kay
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Vitaly Ostanin
> Sent: 08 July 2003 16:57
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: document() for opening multiple documents
>
>
> Hello.
>
> I try to use function document() http://www.w3.org/TR/xslt#document
> for opening multiple source documents, specified in variable
> $file-set (using extension exsl:node-set()).
>
> Main style:
> <?xml version='1.0'?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version='1.0'>
> <xsl:import href="xsl/included.xsl"/>
> </xsl:stylesheet>
>
> Included style (xsl/included.xsl):
> <?xml version='1.0'?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:exsl="http://exslt.org/common"
> extension-element-prefixes="exsl"
> version='1.0'>
> <xsl:variable name="file-set">
> <file>file1.xml</file>
> <file>file2.xml</file>
> </xsl:variable>
> <xsl:template match="/">
> <xsl:for-each
> select="document(exsl:node-set($file-set)/file)"/>
> <xsl:variable name="file">file1.xml</xsl:variable>
> <xsl:for-each
> select="document($file)"/>
> </xsl:template>
> </xsl:stylesheet>
>
>
> When I call document() with variable as first argument,
> file1.xml opened from directory "xsl".
>
> When I call document() with exsl:node-set($file-set) as first
> document, files from $file-set opened (try to open) from the
> current directory.
>
> Please, tell me, what is the base URI for relative URI's from
> node-set ?
>
> I read
> http://www.w3.org/TR/xslt#base-uri
> but not fully understand it.
>
> For my purposes I need include data from multiple files, and
> count of files and filenames are not static. Next I need to use
> key() for accessing data.
>
> In other test I try to include data into variable
>
> <xsl:variable name="file-set">
> <xsl:copy-of select="document('file1.xml')"/>
> <xsl:copy-of select="document('file2.xml')"/>
> </xsl:variable>
>
> but key() not work with variable
> (for me - I use libxml2-2.5.8 and libxslt-1.0.31)
>
> Anybody can help me, please?
>
> --
> Regards, Vyt
> mailto: vyt@xxxxxxxxx
> JID: vyt@xxxxxxxxx
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|