[xslt] how to access default xml



this is not a bugreport

I have a Problem to access the default-xmlfile after
doing 
<xsl:apply-templates select="document('test.xml')">

After this command I can access the nodes of test.xml
but can't access the nodes of the default xml.

The only possibility I found is to open the default
document again with the document function.

Is there an easier way to do that?

AN EXAMPLE:
============

default.xml
========
<?xml version="1.0"?>
<test>This is the default document</test>

test.xml
======
<?xml version="1.0"?>
<nodes>
<node>one</node>
<node>two</node>
</nodes>

test.xslt
======
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              
xmlns:libxslt="http://xmlsoft.org/XSLT/namespace">
 
<xsl:template match="/">
        <xsl:apply-templates select="document('test.xml')" mode="test"/>
</xsl:template>
 
<xsl:template match="*" mode="test">
<xsl:for-each select="/nodes/*">
<xsl:value-of select="."/>
--------------------------
<!--   T H  E    P R O B L E M -->
<!-- switch back to default xml-document -->
        <xsl:apply-templates select="document('default.xml')" 
mode="defaultxml"/>
</xsl:for-each>
 
</xsl:template>
 
<xsl:template match="*" mode="defaultxml">
<xsl:value-of select="."/>
**********************
</xsl:template>
 
</xsl:stylesheet>

command
========
xsltproc test.xslt default.xml

result
====
<?xml version="1.0"?>
one
--------------------------
This is the default document
**********************
two
--------------------------
This is the default document
**********************





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]