W3C home > Mailing lists > Public > public-qt-comments@w3.org > January 2014

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

From: <bugzilla@jessica.w3.org>
Date: Thu, 16 Jan 2014 14:09:26 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-24308-523@http.www.w3.org/Bugs/Public/>

            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).


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

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

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

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:45 UTC