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=2886 *** shadow/2886 Mon Jul 30 06:01:52 2001 --- shadow/2886.tmp.23573 Mon Jul 30 06:01:52 2001 *************** *** 0 **** --- 1,149 ---- + +============================================================================+ + | xsltc fails conf test node25 not selecting templates based on priority cor | + +----------------------------------------------------------------------------+ + | Bug #: 2886 Product: XalanJ2 | + | Status: NEW Version: CurrentCVS | + | Resolution: Platform: All | + | Severity: Normal OS/Version: All | + | Priority: Other Component: org.apache.xalan.xsltc | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + xsltc is incorrectly choosing a template which matched on text() but has an + explicity priority set to -2, over a template matching on node() with no + explicit priority. This is incorrect because the node() and text() match + patterns have a default priority of -.5. Since -.5 is higher than -2, the + template matching on node() should be used in preference over the tempalte + matching on text() for text nodes. + + Expected Results + ================ + <?xml version="1.0" encoding="UTF-8"?> + <out>A:att + N-content: + , + N-named:a-pi..., + N-content: + , + N-content: This is the 1st comment , + N-content: + text-in-doc + , + N-named:inner...A:blat + N-content: + inner-text + , + N-content: This is the 2nd comment , + N-content: + , + N-named:sub...N-content:subtext, + , + N-content: + , + , + N-content: + text-in-doc2 + , + </out> + + Obtained Results + ================ + <?xml version="1.0" encoding="UTF-8"?> + <out>A:att + N-content: + , + N-named:a-pi..., + N-content: + , + N-content: This is the 1st comment , + N-content: + text-in-doc + , + N-named:inner...A:blat + N-content: + inner-text + , + N-content: This is the 2nd comment , + N-content: + , + N-named:sub...N-content:subtext, + , + N-content: + , + , + N-content: + text-in-doc2 + , + </out> + + XSL + === + <?xml version="1.0"?> + <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + + <!-- FileName: node15 --> + <!-- Document: http://www.w3.org/TR/xpath --> + <!-- DocVersion: 19991116 --> + <!-- Section: 2.3 --> + <!-- AdditionalSpec: XSLT 5.2 --> + <!-- Creator: David Marston --> + <!-- Purpose: Test for node() in match patterns. Default axis is child. --> + + <xsl:template match="/doc"> + <out> + <xsl:apply-templates + select="*|@*|comment()|processing-instruction()|text()"/> + </out> + </xsl:template> + + <xsl:template match="node()"> + <xsl:text>N-</xsl:text> + <xsl:choose> + <xsl:when test="name(.)!=''"> + <xsl:text>named:</xsl:text><xsl:value-of + select="name()"/><xsl:text>...</xsl:text> + </xsl:when> + <xsl:when test=".!=''"> + <xsl:text>content:</xsl:text><xsl:value-of select="."/> + </xsl:when> + <xsl:otherwise> + <xsl:text>UNKNOWN</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="@*"/> + <xsl:apply-templates/> + <xsl:text>, + </xsl:text> + </xsl:template> + + <xsl:template match="attribute::*" priority="-1"> + <xsl:text>A:</xsl:text><xsl:value-of select="name()"/> + <xsl:text> + </xsl:text> + </xsl:template> + + <xsl:template match="text()" priority="-2"><!-- Override built-in template --> + <xsl:text>Incorrect text match:</xsl:text><xsl:value-of select="."/> + </xsl:template> + + </xsl:stylesheet> + + XML + === + <?xml version="1.0"?> + <doc att="top"> + <?a-pi some data?> + <!-- This is the 1st comment --> + text-in-doc + <inner blat="blob"> + inner-text + <!-- This is the 2nd comment --> + <sub>subtext</sub> + </inner> + text-in-doc2 + </doc>
