PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL BE LOST SOMEWHERE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3331 *** shadow/3331 Tue Aug 28 22:51:20 2001 --- shadow/3331.tmp.22225 Tue Aug 28 22:51:20 2001 *************** *** 0 **** --- 1,80 ---- + +============================================================================+ + | Passing variables to <apply-templates> sometimes fails | + +----------------------------------------------------------------------------+ + | Bug #: 3331 Product: XalanJ2 | + | Status: NEW Version: CurrentCVS | + | Resolution: Platform: PC | + | Severity: Normal OS/Version: Windows NT/2K | + | Priority: Other Component: org.apache.xalan | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + Given this XML + <?xml version='1.0'?> + <table> + <bozo>yeah baby</bozo> + <row><entry>a1</entry><entry>a2</entry></row> + <row><entry>b1</entry><entry>b2</entry></row> + <row><entry>c1</entry><entry>c2</entry></row> + <entry>on its own</entry> + </table> + + and this style sheet + <?xml version='1.0'?> + <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + + <xsl:template match="/table"> + <xsl:variable name="Test" select="bozo"/> + <foobar> + Test is <xsl:value-of select="$Test"/> + <xsl:apply-templates> + <xsl:with-param name="Test" select='$Test' /> + </xsl:apply-templates> + </foobar> + </xsl:template> + + <xsl:template match="row/entry"> + <xsl:param name="Test"/> + <xent>Test is <xsl:value-of select="$Test"/></xent> + </xsl:template> + </xsl:stylesheet> + + The value of the "Test" variable is not passed to the template and the output + is incorrect. If the match value is changed to "row", it works. + + Output for row/entry + <?xml version="1.0" encoding="UTF-8"?> + <foobar> + Test is yeah baby + yeah baby + <xent>Test is </xent><xent>Test is </xent> + <xent>Test is </xent><xent>Test is </xent> + <xent>Test is </xent><xent>Test is </xent> + on its own + </foobar> + + Output for row + <?xml version="1.0" encoding="UTF-8"?> + <foobar> + Test is yeah baby + yeah baby + <xent>Test is yeah baby</xent> + <xent>Test is yeah baby</xent> + <xent>Test is yeah baby</xent> + on its own + </foobar> + + I have tested another xslt implementation, which gives the following result: + <?xml version="1.0" encoding="UTF-8"?><foobar> + Test is yeah baby + yeah baby + <xent>Test is yeah baby</xent><xent>Test is yeah baby</xent> + <xent>Test is yeah baby</xent><xent>Test is yeah baby</xent> + <xent>Test is yeah baby</xent><xent>Test is yeah baby</xent> + on its own + </foobar>
