ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 19407] New: - XSLT top-level variables don't get re-initalized between transformations
Date Tue, 29 Apr 2003 00:22:14 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19407>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19407

XSLT top-level variables don't get re-initalized between transformations

           Summary: XSLT top-level variables don't get re-initalized between
                    transformations
           Product: Ant
           Version: 1.5.3
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: lenze@seattleu.edu


build.xml:
<project default="test">
  <target name="test">
    <xslt basedir="." destdir="out" includes="in*.xml" style="test.xsl"/>
  </target>
</project>

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

  <xsl:variable name="var" select="string(/test/value)"/>

  <xsl:template match="/">
    The test value is: <xsl:value-of select="$var"/>
  </xsl:template>

</xsl:stylesheet>

in1.xml:
<test>
  <value>from in1.xml</value>
</test>

in2.xml:
<test>
  <value>from in2.xml</value>
</test>

The (incorrect) output:
out/in1.html:
    The test value is: from in1.xml

out/in2.html:
    The test value is: from in1.xml


in2.html should say "from in2.xml". If I remove the variable and just use 
the "/test/value" expression inline, then the correct value is output.

Worse yet, when I keep the top-level variable and remove the string() function 
surrounding "/test/value", I get a NullPointerException when the second file 
is processed.

Mime
View raw message