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 2003/06/23 11:08:37 UTC
DO NOT REPLY [Bug 21008] New: -
Parameter value disappears
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=21008>.
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=21008
Parameter value disappears
Summary: Parameter value disappears
Product: XalanJ2
Version: 2.0.0
Platform: PC
OS/Version: Linux
Status: NEW
Severity: Minor
Priority: Other
Component: org.apache.xalan
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: gstragie@wanadoo.be
Having a input xml
<ELEMENT> value1 </ELEMENT>
<ELEMENT> value2 </ELEMENT>
<ELEMENT> value3 </ELEMENT>
and an xsl
...
<xsl:for-each select="./ELEMENT">
<xsl:apply-templates select=".">
<xsl:with-param name="pos" select="position()"/>
</xsl:apply-templates>
</xsl:for-each>
<xsl:template match="ELEMENT">
<xsl:param name="pos"/>
<xsl:value-of select="$pos"/>
</xsl:template>
The value of $pos in the template is 0, for each ELEMENT.
The work around is to assign "position()" to a variable in the for-each
<xsl:for-each select="./ELEMENT">
<xsl:apply-templates select=".">
<xsl:variable name="var" select="position()"/>
<xsl:with-param name="pos" select="$var"/>
</xsl:apply-templates>
</xsl:for-each>
The bug doesn't occur when using xsltproc. The xalan component is used
with the fop renderer (on the comand line with the -xml and -xsl options, which
permit to produce the FO using xerces and xalan, and produce the output in PDF
in one pass).