[Bug 24308] New: Overriding templates can also be matching templates, but this case has no rules in the spec

https://www.w3.org/Bugs/Public/show_bug.cgi?id=24308

            Bug ID: 24308
           Summary: Overriding templates can also be matching templates,
                    but this case has no rules in the spec
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0
          Assignee: mike@saxonica.com
          Reporter: abel.braaksma@xs4all.nl
        QA Contact: public-qt-comments@w3.org

The only templates that can be overridden are named templates. But if named
templates also contain a mode and a match attribute, the behavior is unclear
(in fact, I could not find any mention of this case).

Example:

<xsl:override>
    <xsl:template match="P" mode="M" name="N" />
<xsl:override>

This example overrides named template N and thus affects xsl:call-template.
However, it (probably) also affects xsl:apply-template. The spec explains[1]
that templates bound to a mode can be overridden by template rules in the
stylesheet, but it is unclear what happens when the new template rule appears
in the xsl:override, let alone what happens when the same node matches the
template rule in the xsl:override and in the stylesheet (main package).

While one could argue that the xsl:override takes precedence or that
declaration order is taken into consideration, the following example is
currently legal but conflicts with the statement "When a template rule
specifies mode="#all" this is interpreted as meaning all modes declared
implicitly or explicitly within the declaring package of the xsl:template
element.":

<xsl:override>
   <xsl:template match="P" mode="#all" name="N" />
</xsl:override>

Perhaps the easiest solution is to disallow mode and match attributes when
xsl:template appears within xsl:override. After all, simply specifying template
rules on the stylesheet level is already enough to define overrides.


[1] http://www.w3.org/TR/xslt-30/#modes-and-packages

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 16 January 2014 14:09:27 UTC