[xsl] document() for opening multiple documents

Subject: [xsl] document() for opening multiple documents
From: Vitaly Ostanin <vyt@xxxxxxxxx>
Date: Tue, 8 Jul 2003 19:56:39 +0400
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


Current Thread