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 30211 - [xslt30] scope of default-validation
Summary: [xslt30] scope of default-validation
Status: NEW
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: 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: 2017-12-20 16:08 UTC by Michael Kay
Modified: 2019-02-19 21:21 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2017-12-20 16:08:52 UTC
We say (in §25.4):

This default applies within the containing stylesheet module or package: it does not extend to included or imported stylesheet modules or used packages.

This could be read as suggesting that if A is the top-level module of a package, and A imports B, then a default-validation attribute within B affects what happens in A. This clearly isn't intended. I suggest deleting "or package".

The spec also says that the attribute "also determines the validation applied to the implicit final result tree created in the absence of an xsl:result-document instruction." But it's not clear in this case which default-validation attributes are relevant. For example if the top-level module has default-validation="preserve", but the module containing the initial template match="/" has default-validation="strict", which one applies? This ambiguity is also present in XSLT 2.0, though it is worse now because in 2.0 default-validation could only be specified on the xsl:stylesheet element whereas now it can also be specified on xsl:template; furthermore, in 3.0 there may be no implicit result tree (the results may be returned raw).

I think the simplest solution to this is to say that it is only the default-validation attribute on the stylesheet/transform/package element of the top-level module of the top-level package that is relevant here. Saying anything else (for example, giving effect to the default-validation on the initial template or initial mode) feels like adding a feature retrospectively. A nice feature perhaps, but a new one.
Comment 1 Michael Kay 2017-12-20 16:36:32 UTC
Note the effect of this is that if you say

<xsl:stylesheet...>


<xsl;template default-validation="strict" name="xsl:initial-template">
  <invoice>
    ...
  </invoice>
</xsl:template>

then strict validation is applied to the invoice element - the spec is clear on this. The question is what validation is applied to the document node that wraps the invoice element. There's nothing in the spec that would warrant strict or lax validation at document level (so no ID/IDREF checking), the question is between STRIP and PRESERVE.

It's unfortunate that the default value of default-validation is effectively "strip", which doesn't seem a desirable outcome.

I think I'd like to propose deleting the sentence "It also determines the validation applied to the implicit final result tree created in the absence of an xsl:result-document instruction." on the basis that it's hopelessly underspecified, and instead say that an implicit result document is handled in the same way as an implicit temporary tree (§9.4):

<quote>
No document-level validation takes place (which means, for example, that there is no checking that ID values are unique). However, type annotations on nodes within the new tree are copied unchanged.
</quote>
Comment 2 Michael Kay 2017-12-21 11:01:19 UTC
I have created test cases validation-1601 to -1607 to test various combinations of default-validation with implicit result documents.

These tests indicate that Saxon is behaving the way I have proposed: document level validation is not applied to the implicit result tree (that is, duplicate ID values are not detected), but the type annotation on the outermost element is preserved, regardless of any default-validation attributes.
Comment 3 Michael Kay 2017-12-21 11:17:14 UTC
As further justification for the proposed resolution, §2.3.6.1 Result Tree Construction defines the process of constructing the implicit result tree from the raw result of the initial template or function, and does so by reference to the rules of sequence normalization in the Serialization spec, which always (a) preserves type annotations on elements in the raw result, and (b) performs no document-level validation.
Comment 4 Abel Braaksma 2019-02-19 21:21:36 UTC
A proposed erratum E15 was published on 13 Feb 2019, HTML version: https://htmlpreview.github.io/?https://github.com/w3c/qtspecs/blob/master/errata/xslt-30/html/xslt-30-errata.html#E15

(I have not yet reviewed this in detail)