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=3360 *** shadow/3360 Thu Aug 30 05:52:21 2001 --- shadow/3360.tmp.18767 Thu Aug 30 05:52:21 2001 *************** *** 0 **** --- 1,145 ---- + +============================================================================+ + | coolrunning search.xsl not filtering | + +----------------------------------------------------------------------------+ + | Bug #: 3360 Product: XalanJ2 | + | Status: NEW Version: 2.0.0 | + | Resolution: Platform: All | + | Severity: Critical OS/Version: All | + | Priority: Other Component: org.apache.xalan.xsltc | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + Something broke in the last couple of weeks, even before Morten's big putback. + The problem is that + + select="//entry[$states=state]" + + in an apply-templates is not filtering out entry nodes whose + state child elements do NOT match the $states parameter + + The //entry is needed because the <entry> elements can + occur withing <series> elements, as well as directly under + the <calendar> element. + + There is a workaround that works! + + select="entry[$states=state]" + select="series/entry[$states=state]" + + I put together very simple test.xml and test.xsl files to reproduce this bug. + + test.xml + -------- + <calendar> + <entry> + <name>first entry</name> + <state>MA</state> + </entry> + <entry> + <name>second entry</name> + <state>NH</state> + </entry> + <series> + <entry> + <name>series entry #1</name> + <state>MA</state> + </entry> + <entry> + <name>series entry #2</name> + <state>MA</state> + </entry> + </series> + </calendar> + + test.xsl + -------- + <?xml version="1.0" ?> + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="html" encoding="iso-8859-1"/> + + <xsl:param name="states" select="''"/> + + <xsl:template match="calendar" > + <html> + <head> + <title>Calendar Search</title> + </head> + <body> + <xsl:apply-templates select="//entry[state=$states]" /> + </body> + </html> + </xsl:template> + + <xsl:template match="entry"> + <xsl:value-of select="."/> + </xsl:template> + + </xsl:stylesheet> + + + The following test session shows that no other XSLT processor matches + any nodes when the "states" parameter is null, but XSLTC matches every 'entry' + node. + + Running saxon on test + <html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + + <title>Calendar Search</title> + </head> + <body></body> + </html> + + Running xt on test + <html> + <head> + <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>Calendar Search</title> + </head> + <body> + </body> + </html> + + Running xalan on test + <html> + <head> + <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>Calendar Search</title> + </head> + <body></body> + </html> + + Running XSLTC with Xerces Parser on test + <html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>Calendar Search</title> + </head> + <body> + first entry + MA + + second entry + NH + + series entry #1 + MA + + series entry #2 + MA + </body> + </html> + + In the above test session no parameter was passed, but you could + do it with "states=NH" and still get the same results: all the nodes selected. + + This problem must be causing some conf tests to fail, but since + it was found with the Coolrunning search servlet, I wanted to + put a specific bug.
