You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/02/05 22:03:57 UTC
DO NOT REPLY [Bug 6255] New: -
Xalan 2.2 mishandles result tree fragment
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=6255>.
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=6255
Xalan 2.2 mishandles result tree fragment
Summary: Xalan 2.2 mishandles result tree fragment
Product: XalanJ2
Version: 2.2.0
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Major
Priority: Other
Component: Xalan
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: pfeiffer@well.com
Xalan is incorrectly processing a result tree fragment in a recursive template.
I am using the following stylesheet (notice the number 3 at the end of
the line marked "NOTICE THIS NUMBER").
---------------- BEGIN STYLESHEET ---------------------
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template name="total-numbers">
<xsl:param name="list"/>3<!-- NOTICE THIS NUMBER -->
<xsl:variable name="wlist"
select="concat(normalize-space($list), ' ')"/>
<xsl:choose>
<xsl:when test="$wlist!=' '">
<xsl:variable name="first"
select="substring-before($wlist, ' ')"/>
<xsl:variable name="rest"
select="substring-after($wlist, ' ')"/>
<xsl:variable name="total">
<xsl:call-template name="total-numbers">
<xsl:with-param name="list" select="$rest"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="number($first) + number($total)"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/">
<xsl:call-template name="total-numbers">
<xsl:with-param name="list" select="."/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
---------------- END STYLESHEET ---------------------
If I use the following input,
---------------- BEGIN INPUT ---------------------
<numbers>12 34.5 18.2 -35</numbers>
---------------- END INPUT ---------------------
The stylesheet should get output like this:
---------------- BEGIN OUTPUT ---------------------
<?xml version="1.0" encoding="utf-8"?>3
NaN
---------------- END OUTPUT ---------------------
Instead, the stylesheet output is
---------------- BEGIN OUTPUT ---------------------
<?xml version="1.0" encoding="UTF-8"?>
3
15
---------------- END OUTPUT ---------------------
This stylesheet came from Michael Kay's book XSLT Programmer's Reference (page
616 of the second edition), and Michael himself verified that this output from
Xalan is incorrect.