This is a known Xalan-J XSLTC issue [1]. Instead of using the XSLT document() function you could use the Include transformer [2] which supports caching. We use it successfully in our project.

Alex

[1] http://issues.apache.org/jira/browse/XALANJ-1928
[2] http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/ transformation/IncludeTransformer.html
[3] http://cocoon.apache.org/2.2/core-modules/core/2.2/1048_1_1.html

On 07.11.2007, at 12:31, Tobia Conforto wrote:

I think I stumbled upon a bug in the XSLTC transfomer regarding the
document() function.  Here is a minimal example:


--- sitemap fragment: --------------------------------------

<match pattern="test">
  <generate src="foo.xml"/>
  <transform src="foo-bar.xsl" type="xsltc"/>
  <serialize type="xml"/>
</match>

--- foo.xml: -----------------------------------------------

<foo/>

--- bar.xml: -----------------------------------------------

<bar/>

--- foo-bar.xsl: -------------------------------------------

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform">

  <xsl:variable name="foo" select="/"/>
  <xsl:variable name="bar" select="document('bar.xml')"/>

  <xsl:template match="/">
    <output>
      <foo><xsl:value-of select="name($foo/*)"/></foo>
      <bar><xsl:value-of select="name($bar/*)"/></bar>
    </output>
  </xsl:template>

</xsl:stylesheet>

------------------------------------------------------------


The output I would expect, which is also the output I get using the
default xslt (Xalan-J interpretive) transformer is:

<output>
  <foo>foo</foo>
  <bar>bar</bar>
</output>

But if I use the xsltc (Xalan-J compiled) transformer the output is:

<output>
  <foo>bar</foo>
  <bar>bar</bar>
</output>

It would appear that the document() call overwrites the source document
of the transformation, including all existing references to it.

Is this a known bug?  Can anybody confirm/reproduce it?


Tobia

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to