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 6951 - [DM] Conflicting requirements for type annotations from XSLT validation='lax' and XDM
Summary: [DM] Conflicting requirements for type annotations from XSLT validation='lax'...
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Data Model 1.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Anders Berglund
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL: http://www.w3.org/TR/xslt20/#validati...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-25 16:44 UTC by Henry Zongaro
Modified: 2010-04-15 17:28 UTC (History)
0 users

See Also:


Attachments

Description Henry Zongaro 2009-05-25 16:44:39 UTC
The fourth bullet of the list in section 19.2.1.1 of XSLT 2.0[1] states, in part:

"In practice this means that the element or attribute being validated must conform to its declaration if a top-level declaration is available. If no such declaration is available, then the element or attribute is not validated, but its attributes and children are validated, again with lax validation. Any nodes whose validation outcome is a validity property of notKnown are annotated as xs:anyType in the case of an element, and xs:untypedAtomic in the case of an attribute."

According to the second and third bullets of section 3.3.1.1 of XDM,[2] if:

- The [validity] property exists and is "invalid", or the [validation attempted] property exists and is "partial", the schema type of an element is xs:anyType and the type of an attribute is xs:anySimpleType.
- The [validity] property exists and is "notKnown", and the [validation attempted] property exists and is "none", the schema type of an element is xs:untyped and the type of an attribute is xs:untypedAtomic.


Now suppose I have something like the following fragment in XSLT.

  <my:doc xsl:validation="lax" xmlns:my="http://example.org"><my:child/></doc>

Now assume there is no element declaration for my:doc, but there is an element declaration for my:child, and the element information item is valid with respect to it.  Reading section 3.3.5 of XML Schema: Structures,[3] I believe that the PSVI for my:child will have [validity] property "valid" and [validation attempted] "full", and the PSVI for my:doc will have [validity] property "notKnown" and [validation attempted] "partial".  So from the text I've quoted in XDM, the type of my:doc should be xs:anyType, which agrees with XSLT.

However, if neither my:doc nor my:child have element declarations, my reading of Structures is that the PSVI for both my:doc and for my:child will have [validity] property "notKnown" and [validation attempted] "none", and so the type of both nodes should be xs:untyped, according to XDM, which conflicts with the assertion I've quoted from XSLT 2.0.

I suggest correcting this by striking the sentence that begins "Any nodes whose validation outcome is a validity property of notKnown" from the fourth bullet of 19.2.1.1 of XSLT 2.0.

[1] http://www.w3.org/TR/xslt20/#validating-using-validation-attribute
[2] http://www.w3.org/TR/xpath-datamodel/#PSVI2NodeTypes
[3] http://www.w3.org/TR/xmlschema-1/#d0e5070
Comment 1 Michael Kay 2009-12-07 15:21:13 UTC
Discussion of this bug has taken place by email on the thread starting at

http://lists.w3.org/Archives/Member/w3c-xsl-query/2009Nov/0070.html

[member-only]
Comment 2 Michael Kay 2009-12-07 15:50:09 UTC
Following email discussion and discussion at the telcon on 2009-11-17, there was agreement in principle that when lax validation "succeeds", the resulting document should always be annotated as xs:anyType rather than xs:untyped regardless whether any elements were found that could actually be validated: this ensures that the process can be streamed, and it means that the accidental presence of an insignificant declaration in the schema (for example a declaration for the xml:lang attribute) does not switch the whole document from xs:untyped to xs:anyType.

I was actioned to propose wording changes to implement this decision. I believe it can be effected by changing the third bullet in XDM section 3.3.1.1 from

<old>The [validity] property exists and is "notKnown", and the [validation attempted] property exists and is "none", the schema type of an element is xs:untyped and the type of an attribute is xs:untypedAtomic.</old>

to

<new>The [validity] property exists and is "notKnown", the schema type of an element is xs:anyType and the type of an attribute is xs:anyAtomicType.</new>


Comment 3 Henry Zongaro 2009-12-08 00:54:58 UTC
Did you really mean for the attribute's type annotation to be xs:anyAtomicType rather than xs:anySimpleType?
Comment 4 Michael Kay 2009-12-08 07:24:29 UTC
No, sorry! That should read

<new>The [validity] property exists and is "notKnown", the schema type of an
element is xs:anyType and the type of an attribute is xs:anySimpleType.</new>
Comment 5 Michael Kay 2009-12-08 16:42:09 UTC
On 8 Dec 2009 the joint WGs agreed to make this change, both to the 1.0 and 1.1 XDM specifications.
Comment 6 Henry Zongaro 2010-04-15 17:28:18 UTC
[I updated the summary field to indicate this ended up being a Data Model problem rather than an XSLT problem.]

According to the minutes of the joint XQuery/XSL meeting of 2009-12-08,[4] two action item were raised:

ACTION A-420-01: Norm to update XDM to incorporate text from comment 4 to
    resolve bug #6951.

ACTION A-420-02: Norm to process an erratum to incorporate text from  
   comment 4 to resolve bug #6951.

Norm Walsh reported in [5] that he had completed A-420-01, and that he believed A-420-02 should be assigned to Anders as editor of the XML Data Model 1.0 recommendation.  So I'm reassigning the bug accordingly.

[4] http://lists.w3.org/Archives/Member/w3c-xsl-query/2009Dec/0028.html (member-only link)
[5] http://lists.w3.org/Archives/Member/w3c-xsl-query/2010Jan/0065.html (member-only link)