<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>29957</bug_id>
          
          <creation_ts>2016-10-22 22:18:28 +0000</creation_ts>
          <short_desc>[XSLT30] Non-schema-aware processors and schema-attribute and schema-element node tests: error or not?</short_desc>
          <delta_ts>2016-10-27 16:51:06 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XSLT 3.0</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Abel Braaksma">abel.braaksma</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>127934</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-10-22 22:18:28 +0000</bug_when>
    <thetext>In XPath, the descriptions of schema-attribute and schema-element node tests are in reference to the in-scope schema definitions (namely, the in-scope attribute declarations and in-scope element declarations).

If such declaration is not found, XPST0008 must be raised.

However, in XPath it is also defined that the test succeeds if the type derives-from the declared type, and the name matches.

In XSLT in contrast we say that any SequenceType other than xs:untyped and xs:untypedAtomic for as-clauses should raise error XTSE1660, but there&apos;s no mention of node tests.

It stands to reason (but couldn&apos;t find this) that the in-scope schema definitions are the empty set for non-schema-aware processors. But one could also argue that these definitions automatically include mappings for xs:untyped and xs:untypedAtomic for all elements/attributes.

It&apos;s unclear to me whether match=&quot;schema-attribute(&apos;foo&apos;, &apos;xs:int&apos;)&quot; should be rejected, whether it should ignore &apos;xs:int&apos; and match on &apos;foo&apos;, or whether, if rejected, it should raise XTSE1660 or XPST0008.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127939</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-10-23 08:49:55 +0000</bug_when>
    <thetext>&gt;But one could also argue that these definitions automatically include mappings for xs:untyped and xs:untypedAtomic for all elements/attributes.

I don&apos;t quite see what form such an argument might take.

XSLT 5.3.1 says: The in-scope schema definitionsXP30 for the XPath expression are the same as the in-scope schema components for the stylesheet, and are as specified in 3.14 Built-in Types. [The reference should really include 3.15 as well.]

Section 3.15 says: The schema components included in the in-scope schema components (that is, the components whose names are available for use within the stylesheet) are the top-level element and attribute declarations and type definitions that are available for reference within the synthetic schema document. See [XML Schema Part 1] (section 4.2.3, References to schema components across namespaces).

If there is no import-schema, then the synthetic schema document contains no global attribute declarations, therefore schema-element(foo) refers to an attribute name that is not present in the in-scope schema declarations, therefore a static error occurs.

The error code XTSE1660 applies specifically to non-schema-aware processors, not to schema-aware processors when there is no imported schema, and there&apos;s room for debate about which error code takes precedence. But either way, &quot;foo&quot; is not in the in-scope schema declarations and therefore can&apos;t be referenced in schema-attribute().

XPath says &quot;If the ElementName specified in the SchemaElementTest is not found in the in-scope element declarations, a static error is raised [err:XPST0008].&quot; which seems pretty unambiguous to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127941</commentid>
    <comment_count>2</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-10-24 09:36:19 +0000</bug_when>
    <thetext>Somehow I came to the conclusion that if you use that type that it automatically exists (in that &quot;give me an element X with type annotation Y&quot;).

But now I think that my reasoning took a shortcut. Using schema-element *requires* a declaration in a schema to be present for that element. That all elements are considered to be of type xs:untyped is irrelevant.

(conversely, if my argument were correct in any sense, using schema-element(x) would have little effect if it meant that any element existed automatically as xs:untyped element)

So, bottom line, schema-element() and schema-attribute() cannot possibly select anything for non-schema-aware processors and will always raise one of these two errors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127972</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-10-27 16:51:06 +0000</bug_when>
    <thetext>Closed with no action.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>