[ http://issues.apache.org/jira/browse/XALANJ-590?page=all ]
Brian Minchau updated XALANJ-590:
---------------------------------
Version: 2.2.0
(was: Latest Development Code)
> Identically-matching templates are silently accepted
> ----------------------------------------------------
>
> Key: XALANJ-590
> URL: http://issues.apache.org/jira/browse/XALANJ-590
> Project: XalanJ2
> Type: Bug
> Components: Xalan
> Versions: 2.2.0
> Environment: Operating System: All
> Platform: All
> Reporter: Gunnlaugur Thor Briem
> Assignee: Xalan Developers Mailing List
>
> Xalan (as of version 2.2.D10 at least) silently accepts stylesheets containing
> multiple templates matching the same pattern in the same mode, and just uses
> the one that occurs last.
> According to section 5.5 of the XSLT 1.0 spec:
> "It is an error if this leaves more than one matching template
> rule. An XSLT processor may signal the error; if it does not signal
> the error, it must recover by choosing, from amongst the matching
> template rules that are left, the one that occurs last in the
> stylesheet."
> ... so this behavior IS allowed by the spec. But I'd argue that that's a
> rather
> heinous mistake in the specification: resolving the ambiguity by just picking
> the last one has no practical utility that I can think of, and clearly invites
> errors by the stylesheet writer (such as the one I made, which led me to
> discover this!), so taking the option of signalling the error seems far
> preferable.
> To illustrate, here's an example stylesheet that I think should be rejected:
> <?xml version='1.0'?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match="/root">
> <outroot>
> <xsl:apply-templates/>
> </outroot>
> </xsl:template>
>
> <xsl:template match="text()">
> <xsl:text>{TEXT-BEGIN}</xsl:text>
> <xsl:copy-of select="."/>
> <xsl:text>{TEXT-END}</xsl:text>
> </xsl:template>
> <xsl:template match="text()">
> <xsl:text>{TEXT-BEGIN-2}</xsl:text>
> <xsl:copy-of select="."/>
> <xsl:text>{TEXT-END-2}</xsl:text>
> </xsl:template>
> </xsl:stylesheet>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]