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 22061 - [XSLT 3.0] Omissions in the schema for XSLT 3.0
Summary: [XSLT 3.0] Omissions in the schema for XSLT 3.0
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-16 11:51 UTC by Michael Kay
Modified: 2014-05-15 14:00 UTC (History)
1 user (show)

See Also:


Attachments
revised XSD 1.1 schema for XSLT 3.0 (76.14 KB, application/octet-stream)
2013-11-28 03:08 UTC, C. M. Sperberg-McQueen
Details
re-revised XSD 1.1 schema for XSLT 3.0 (28 Nov 2013) (80.03 KB, application/octet-stream)
2013-11-29 03:48 UTC, C. M. Sperberg-McQueen
Details
re-re-revisde XSD 1.1 schema for XSLT 3.0 (29 Nov 2013) (83.73 KB, application/octet-stream)
2013-11-29 16:14 UTC, Michael Kay
Details

Description Michael Kay 2013-05-16 11:51:14 UTC
Email on xslwg list from Innovimax dated 5 May 2013:


Dear all,

Here are few fix to apply to XML Schema 1.1 for XSLT 3.0

a) it misses all the bits about attribute expand-text
b) it says that the select attribute on xsl:try is required
c) it says that the errors attribute on xsl:catch is required
d) I have a failed assertion with Saxon about the expression
<xs:assert test="if (exists(@value)) then empty((@select, @level,
@count, @from)) else true()">
e) it allows only 0 or 1 xsl:merge-action as direct child of xsl:merge
f) it misses xsl:map
g)it misses xsl:map-entry
h) it misses the static attribute

Hope this helps

Mohamed
Comment 1 C. M. Sperberg-McQueen 2013-11-28 03:08:08 UTC
Created attachment 1417 [details]
revised XSD 1.1 schema for XSLT 3.0

A revised schema document is attached.  I believe that the attached schema document fixes all the problems noted (with one possible exception).  I have not tested it independently.  Notes on details:

a) it misses all the bits about attribute expand-text

The attribute expand-text has been added to the complex type generic-element-type and to the attribute group literal-result-element-attributes.

b) it says that the select attribute on xsl:try is required

Made optional, to agree with syntax diagram in spec.

c) it says that the errors attribute on xsl:catch is required

Made optional, to agree with syntax diagram in spec.

d) I have a failed assertion with Saxon about the expression
<xs:assert test="if (exists(@value)) then empty((@select, @level,
@count, @from)) else true()">

Could not reproduce (and don't see a problem with the test), so no change made.

e) it allows only 0 or 1 xsl:merge-action as direct child of xsl:merge

I think this must be a typo:  the schema allows exactly one merge-action as a child of merge, not 0 or 1.  This is also what the syntax diagram says.  On the other hand the schema document allows 0 or 1 merge-source, where the syntax diagram has a plus.  Changed to minOccurs="1" maxOccurs="unbounded".

f) it misses xsl:map

Added.

g)it misses xsl:map-entry

Added.

h) it misses the static attribute

Added to the types of param and variable, with assertions constraining the use of static='yes' to cases with visibliity="private" or "final", and also an assertion on xsl:transform to check that 'static' is used only on top-level param and variable elements.
Comment 2 C. M. Sperberg-McQueen 2013-11-29 03:48:18 UTC
Created attachment 1418 [details]
re-revised XSD 1.1 schema for XSLT 3.0 (28 Nov 2013)

Some further revisions have been undertaken to align the schema document with the examples in the spec and in a few cases with the text of the spec (in a few cases, but no systematic pass through all syntax descriptions of the spec has been made; I just dealt with what I happened to notice).

Differences from the schema document in the most recent draft include:

1 default-mode, default-validation, and expand-text attributes are added to the generic-element-type and to the literal-result-attributes attribute group.  This involved removing default-validation from xsl:transform.

2 catch/@query is optional not required.

3 override-extension-function, identity-sensitive, and cache attributes added to function element.

4 map and map-entry elements declared.

5 content model of merge corrected. 

6 The assertion on xsl:number has been changed; in its existing form it cannot succeed because @level has a default value.

7 package/@input-type-annotations declared.

8 @static added to param and variable, with various assertions to approximate the rules governing its use, including one on xsl:transform.

9 transform/@version is made optional not required.  (A context-sensitive declaration of xsl:transform could enforce the rule, but I have not inserted one.  Yet.)

10 try/@select is optional not required.
Comment 3 Michael Kay 2013-11-29 11:37:42 UTC
Some problems which I have fixed as a result of running test case catalog-005 which validates the XSLT documents in the test suite:

* xsl:sort/@stable permits an AVT

* an attribute of type EQName permits leading and trailing whitespace. I've fixed this by deriving the relevant member type of EQName from xs:token rather than xs:string, though the XPath grammar appears to allow the namespace name to contain embedded spaces.

* the regex for EQName needs to be \i\c* rather than \i\c+ to allow single-character names.

* added support for mode="#unnamed" in xsl:template and xsl:apply-templates

* XSLT 3.0 no longer requires xsl:import declarations to precede other declarations

* added the serialisation parameter html-version

* xsl:evaluate/@schema-aware should be an AVT

* On various tests e.g. use-when-0108 I get an error saying attributes in a foreign namespace are not allowed on xsl:variable. I think this might be a bug in the schema but I haven't yet pinned it down.

* I have added some notes to the commentary explaining the limitations of the schema, e.g. in handling use-when attributes, forwards compatibility mode, literal result elements, etc.


The exercise did pick up some interesting errors:

* in test validation-0201, the stylesheet (for no good reason) has an invalid xsi:schemaLocation attribute, which is against the XSD rules but not the XSLT rules.

* in import-schema-064, the stylesheet deliberately contains an invalid xsi:type attribute, which XSLT allows but XSD does not. Some other tests (e.g. namespace-2601) fail validation because they use an AVT in an xsi:type attribute.

* namespace-2616, 3003, 3004 attempt to generate XSD declarations using literal result elements, which are of course invalid against the schema-for-schema-documents.

* the validation process fails to handle embedded stylesheets such as include0102a.xml
or simplified stylesheets such as math-3318.xsl. For these we need to do lax validation, which would cause a lot of errors to slip through the net.

* tests iterate-016, -017, -018, -030 have an xsl:fallback instruction after xsl:on-completion. We should probably allow this, but we don't, and the schema picks it up. I have changed the tests to match the schema.

* similarly, xslt-compat-006 uses xxl:fallback before xsl:matching-substring, which the spec does not allow.
Comment 4 Michael Kay 2013-11-29 12:04:44 UTC
The problem with foreign-namespace attributes on xsl:variable was because of XSD's insistence that an attribute wildcard is repeated every time you do a restriction (explicit attributes are included in the restriction by default, attribute wildcards are not). The type sequence-constructor-or-select failed to copy the wildcard across.
Comment 5 Michael Kay 2013-11-29 12:54:25 UTC
Further changes:

* xsl:assert/@enabled has been dropped

* added xsl:attribute-set/@streamable

* added xsl:evaluate/@with-params

* deleted the unused group function-model

* xs:map-entry/@key is required

* added @parameter-document to xsl:output and xsl:result-document

* refactored the assertion concerning the visibility of static params/variables

* xsl:stream/@href is an AVT

* all emumerated lists of keywords now restrict xs:token, rather than xs:NMTOKEN, xs:NCName, or xs:string
Comment 6 C. M. Sperberg-McQueen 2013-11-29 15:49:44 UTC
A small point which arises most obviously when the process of validating all 'pre' elements in the HTML version of the working draft against the schema defined in Appendix H reaches the point of validating Appendix H itself.  The schema for XSLT documents includes the schema for schema documents (to allow for inline schemas), using the construct:

  <xs:import namespace="http://www.w3.org/2001/XMLSchema"
             schemaLocation="http://www.w3.org/2001/XMLSchema.xsd"/>

The URI given points to the schema for XSD 1.0 schema documents (so Appendix H turns up as invalid owing to the various 1.1 constructs); if an XSLT 3.0 stylesheet which includes an inline XSD 1.1 schema is to be valid, then  we should change the import to read:

  <xs:import namespace="http://www.w3.org/2001/XMLSchema"
             schemaLocation="http://www.w3.org/2009/XMLSchema/XMLSchema.xsd"/>

or even just

  <xs:import namespace="http://www.w3.org/2001/XMLSchema"/>

but that does put more of a burden on the user.
Comment 7 Michael Kay 2013-11-29 16:09:42 UTC
The schema now validates all stylesheets in the test collection except those that

* have a root element not in the XSLT namespace
* have a version attribute (somewhere) > 3.0
* use use-when
* use xsi:type
* contain literal result elements in the XSD namespace.

See test case catalog-005 which runs the validation.

A new schema is being uploaded and the bug will be closed.
Comment 8 Michael Kay 2013-11-29 16:11:11 UTC
Concerning point 6, I'll add that observation to the commentary at the start of the schema.
Comment 9 Michael Kay 2013-11-29 16:14:58 UTC
Created attachment 1419 [details]
re-re-revisde XSD 1.1 schema for XSLT 3.0 (29 Nov 2013)