Joerg Heinicke wrote:
>
> If that's true, it's definitely a bug. Using document() without a second
> parameter should resolve the path relative to the stylesheet. Only
> passing a node-set as second argument changes this behaviour, the path
> is resolved relative to this node-set:
>
ok confirmed with forrest-0.6-dev/cocoon-2.1.3
i've got 4 files within this kind of hierachie:
content/
xdocs/
test.xml
file.xml
resources/
stylesheets/
test.xsl
file.xml
here are the files
content/xdocs/test.xml
--------
<?xml version="1.0"?>
<test>
<test1/>
<test2 filename="file.xml"/>
</test>
content/xdocs/file.xml
----------------------
<?xml version="1.0"?>
<wrong_file/>
resources/stylesheets/file.xml
------------------------------
<?xml version="1.0"?>
<right_file/>
resources/stylesheets/test.xsl
------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="filename"/>
<!-- -->
<xsl:template match="test1">
<xsl:apply-templates select="document($filename)"/>
</xsl:template>
<!-- -->
<xsl:template match="test2">
<xsl:apply-templates select="document(@filename)"/>
</xsl:template>
<!-- -->
<xsl:template match="@*|*|text()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()
processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
sitemap
-------
<map:transformer name="xslt"
src="org.apache.cocoon.transformation.TraxTransformer"
logger="sitemap.transformer.xslt" pool-max="32" pool-min="8" pool-grow="2">
<use-request-parameters>false</use-request-parameters>
<use-browser-capabilities-db>false</use-browser-capabilities-db>
<use-deli>false</use-deli>
<transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
</map:transformer>
...
<map:match pattern="test.xml">
<map:generate src="{project:content.xdocs}/test.xml"/>
<map:transform src="{project:resources.stylesheets}/test.xsl"
type="xslt">
<map:parameter name="filename" value="file.xml"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
...
result of request file.xml
--------------------------
<?xml version="1.0"?>
<test>
<good_file/>
<wrong_file/>
</test>