This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29379 - [XT30] mode-1701 expects success, but should probably fail with XTDE0045
Summary: [XT30] mode-1701 expects success, but should probably fail with XTDE0045
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 Test Suite (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Abel Braaksma
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-17 18:56 UTC by Abel Braaksma
Modified: 2016-07-07 16:03 UTC (History)
1 user (show)

See Also:


Attachments

Description Abel Braaksma 2016-01-17 18:56:26 UTC
The stylesheet for this test is:

<xsl:package
  package-version="1.0.0"
  version="3.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="xs"
  default-mode="a">
  
  <xsl:mode name="a"/>
  
  <xsl:template match="/">
    <ok/>
  </xsl:template>

</xsl:package>   

And the test metadata specifies:

<test-case name="mode-1701">
   <description>Test attribute default-mode on package element</description>
   <created by="Debbie Lockett" on="2015-09-07"/>
   <environment ref="mode-01"/>
   <dependencies>
      <spec value="XSLT30+"/>
   </dependencies>
   <test>
      <package file="mode-1701.xsl" role="principal"/>
      <initial-mode name="a"/>
   </test>
   <result>
      <assert>/ok</assert>
   </result>
</test-case>

In other words: an initial mode is given *outside* the scope of the package. Even though the package defines a default mode, this is irrelevant, as an initial mode is given.

Since the initial mode here is private by default (absent visibility attribute), it cannot be found. Therefore the test should fail with an XTDE0045 error.

Alternatively, the stylesheet invocation should not specify an initial mode, in which case the default mode on xsl:package takes over. Since now the default mode is "in scope", the test would succeed.
Comment 1 Abel Braaksma 2016-01-17 18:58:01 UTC
Added "need more info @mike@saxonica.com", I would like this bug to be reviewed before I attempt to fix it.
Comment 2 Abel Braaksma 2016-01-17 22:36:53 UTC
The issue also applies to tests:
- mode-1702 (debatable: is an implicit mode public or private?)
- mode-1705 (initial-mode "a", which is private)
- mode-1707 (initial-mode "a", which is private)
- mode-1710 (initial-mode "a", which is private)
- mode-1712 (initial-mode "a", which is private)

It does not apply to (for comparison):
- mode-1711 (no initial-mode set, defaults to #unnamed, which is allowed)
- mode-1706 (initial-mode: #unnamed, which is invokable by default, even though it is private)
Comment 3 Abel Braaksma 2016-01-17 22:55:41 UTC
> - mode-1702 (debatable: is an implicit mode public or private?)
Actually, the metadata here sets the initial mode to "a", which does not exist (the fact that there's a default-mode="a" does not matter). This test as currently written should throw XTDE0045.
Comment 4 Michael Kay 2016-01-17 23:58:28 UTC
I don't recall whether it's by design, but XTDE0045 says:

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

while XTDE0040 says:

[ERR XTDE0040] It is a dynamic error if the invocation of the stylesheet specifies a template name that does not match the expanded QName of a named template defined in the stylesheet, *whose visibility is public or final*.

and XTDE0041 says:

[ERR XTDE0041] It is a dynamic error if the invocation of the stylesheet specifies a function name and arity that does not match the expanded QName and arity of a named stylesheet function defined in the stylesheet, *whose visibility is public or final*.

Note the absence of the phrase *whose visibility is public or final* from XTDE0045.

However, 6.6.1 says: "A named mode is not eligible to be used as the initial mode if its visibility is private."
Comment 5 Abel Braaksma 2016-02-16 16:31:43 UTC
We discussed this at the F2F of XML Prague, Feb 16, 2016, 2nd day and decided that:

1) the initial mode must be public
2) the initial mode, if it is the unnamed (default) mode it can only be the mode of the principle stylesheet module
3) the unnamed mode can never be public if not in a principle stylesheet module (is local to the package).

and to:
1) make the modes public in the tests so that they succeed as written
2) add a few copies of these tests that fail with the expected error code
3) raise a spec-bug to resolve the description of XTDE0045.
Comment 6 Abel Braaksma 2016-02-20 14:36:41 UTC
(In reply to Abel Braaksma from comment #5)
> 3) raise a spec-bug to resolve the description of XTDE0045.
Done, see Bug 29491.
Comment 7 Abel Braaksma 2016-07-07 16:03:18 UTC
Changes have been applied.