W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2015

[Bug 28775] New: [XSLT30] Suggestion: prioritise templates with named modes over templates with mode="#all"

From: <bugzilla@jessica.w3.org>
Date: Sat, 06 Jun 2015 17:15:15 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-28775-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=28775

            Bug ID: 28775
           Summary: [XSLT30] Suggestion: prioritise templates with named
                    modes over templates with mode="#all"
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0
          Assignee: mike@saxonica.com
          Reporter: tomos.hillman@oup.com
        QA Contact: public-qt-comments@w3.org

Consider the following in XSLT 2:

<xsl:template match="node()|@*" mode="#all">
  <xsl:apply-templates select="node()|@*" mode="#current"/>
</xsl:template>

<xsl:template match="element" mode="someMode">
  -Some operation-
</xsl:template>

<xsl:template match="text()[contains(., 'x')] mode="anotherMode"
priority="-0.4">
 -Another operation-
</xsl:template>

The only way to avoid a conflict between the first and third templates is to
assign the third with an explicit priority.  This is a niggle, and may become a
risk where stylesheets have multiple authors (or long periods between edits)

This is un-necessary with the second template because the named element always
has a higher precedence than the generic 'node()'.

My suggestion is that, in a similar way, named modes should always have a
higher precedence than the generic '#all' mode for XSLT 3

You could point out that the 'better' way of approaching the problem is with
the use of template rules on mode elements; this is true, but I think this is
still a valid bug because
1. as reported in bug 28774 this exact behaviour is not replicated by
shallow-skip
2. If XSLT 3 is also implementing #all, the same limitations will apply.

I believe such a change would be backwards compatible.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Saturday, 6 June 2015 17:15:18 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 6 June 2015 17:15:18 UTC