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

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

--- Comment #2 from Tom Hillman <tomos.hillman@oup.com> ---
This teaches me for writing examples without testing them!

Here's a better example:

Input document:

<text>Only the text such as <element><b>Hello</b> World!</element> will be
output</text>

Stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"
version="2.0">

  <xsl:output method="text"/>

  <xsl:template match="text()" mode="text">
    <xsl:value-of select="."/>
  </xsl:template>

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

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

</xsl:stylesheet>

Desired output:
Hello World!

In it's current format, the stylesheet doesn't work (Saxon throws a couple of
ambiguous match warnings).  The stylesheet does work if you specify the
priority on the first template.

You can also resolve the behaviour by moving the match template to the end of
the stylesheet, but this seems unreliable to me and still leaves the warnings.

It is a shame that the behaviour isn't backwards compatible, and I would
understand if that precludes any change; I still think that for the future it's
better to have a defined behaviour than relying on implementation choices.

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

Received on Sunday, 7 June 2015 09:43:08 UTC