[Bug 29234] [xslt30ts] package-908

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

--- Comment #2 from Michael Kay <mike@saxonica.com> ---
The error says:

It is a static error, when the effective value of the declared-modes attribute
of an xsl:package element is yes, if the package contains an explicit reference
to an undeclared mode, or if it implicitly uses the unnamed mode and the
unnamed mode is undeclared. A mode is declared if the package contains an
xsl:mode declaration for that mode, or if the mode is a public or final mode
accepted from a used package. The offending reference may occur in the mode
attribute of an xsl:template or xsl:apply-templates instruction, or in an
[xsl:]default-mode attribute. The offending reference may be either an explicit
mode name, or the token #unnamed treated as a reference to the unnamed mode. A
package implicitly uses the unnamed mode if there is an xsl:template or
xsl:apply-templates element with no mode attribute, and with no
ancestor-or-self having an [xsl:]default-mode attribute.

Let's analyze:

It is a static error, when the effective value of the declared-modes attribute
of an xsl:package element is yes [TRUE], if the package contains an explicit
reference to an undeclared mode [FALSE], or if it implicitly uses the unnamed
mode [FALSE: SEE [X] BELOW] and the unnamed mode is undeclared [TRUE]. [...]

[X] A package implicitly uses the unnamed mode if there is an xsl:template or
xsl:apply-templates element with no mode attribute, and with no
ancestor-or-self having an [xsl:]default-mode attribute.

The package does not contain an xsl:template or xsl:apply-templates instruction
therefore it does not implicitly use the unnamed mode. So in my view, there is
no error.

If there is an error, then it's certainly not a static error because if we
follow the reasoning in comment 1 it can only be discovered at invocation time.
Perhaps we could define a static error if a stylesheet has no invocable modes,
named templates, or functions, but that would be a different error entirely.

The closest error I can see is: [ERR XTDE0045] It is a dynamic error if the
invocation of the stylesheet specifies an initial mode (other than the unnamed
mode) that does not match either the expanded QName in the name attribute of an
xsl:mode declaration, or the expanded QName in the mode attribute of any
template defined in the stylesheet.

But that error explicitly exempts the unnamed mode.

Perhaps a way forward on this is to extend XTDE0045 so it reads:

[ERR XTDE0045] If the invocation of the stylesheet specifies an initial mode
that does not match the expanded QName in the name attribute of any non-private
xsl:mode declaration, then a dynamic error occurs if either (a) the effective
value of declared-modes on the top-level package is "no", or (b) the initial
mode is not the unnamed mode and does not match the expanded QName in the mode
attribute of any template defined in the stylesheet.

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

Received on Monday, 26 October 2015 17:22:26 UTC