<?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>26862</bug_id>
          
          <creation_ts>2014-09-19 16:55:26 +0000</creation_ts>
          <short_desc>serialize-xml-007a should expect SEPM0017</short_desc>
          <delta_ts>2015-10-13 00:04:53 +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>Serialization 3.1</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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="Josh Spiegel">josh.spiegel</reporter>
          <assigned_to name="C. M. Sperberg-McQueen">cmsmcq</assigned_to>
          <cc>andrew_coleman</cc>
    
    <cc>mike</cc>
          
          <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>111809</commentid>
    <comment_count>0</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2014-09-19 16:55:26 +0000</bug_when>
    <thetext>Test serialize-xml-007a should allow SEPM0017.  Here are the given serialization parameters:

&lt;output:serialization-parameters
xmlns:output=&quot;http://www.w3.org/2010/xslt-xquery-serialization&quot;&gt;
  &lt;output:method value=&quot;xml&quot;/&gt;   
  &lt;output:indent value=&quot;yes&quot;/&gt;
  &lt;vendor:xindent value=&quot;yes&quot; xmlns:vendor=&quot;http://vendor.example.com/&quot;/&gt;
&lt;/output:serialization-parameters&gt;

This is not an instance of the schema:
http://www.w3.org/TR/xslt-xquery-serialization-30/#serparams-schema

And this expression:

(validate lax { document { . } })
   /output:serialization-parameters
   /output:*[local-name() eq $param-name]/data(@value)

Would raise a validation error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114924</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-11-14 09:50:07 +0000</bug_when>
    <thetext>I&apos;m changing this to a spec bug. The documentation of the schema for serialization parameters claims that it is extensible, but the only extension point appears to be (uselessly) in the character-map element. I think the schema should contain an xs:any wildcard in the complexType of element serialization-parameters if it is to match its documentation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114933</commentid>
    <comment_count>2</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2014-11-14 15:07:41 +0000</bug_when>
    <thetext>I think it could be extended by creating another schema that uses the substitution group, e.g.

&lt;xs:import namespace=&quot;http://www.w3.org/2010/xslt-xquery-serialization&quot;/&gt;
...
&lt;xs:element name=&quot;xindent&quot; type=&quot;...&quot; substitutionGroup=&quot;output:serialization-parameter-element&quot;/&gt;
...

Am I missing something?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115918</commentid>
    <comment_count>3</comment_count>
    <who name="Andrew Coleman">andrew_coleman</who>
    <bug_when>2014-12-04 13:49:09 +0000</bug_when>
    <thetext>As agreed at the telecon on 2014-12-02, the schema definition for serialization-parameters should be a repeating choice group containing the parameters defined in this spec together with a wildcard (xs:any) for extension parameters.  I have modified the schema to the following...

  &lt;xs:element name=&quot;serialization-parameters&quot;&gt;
    &lt;xs:complexType&gt;
      &lt;xs:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;
        &lt;xs:element ref=&quot;output:serialization-parameter-element&quot;/&gt;
        &lt;xs:any namespace=&quot;##other&quot;
                processContents=&quot;lax&quot;/&gt;
      &lt;/xs:choice&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122494</commentid>
    <comment_count>4</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2015-08-06 14:15:50 +0000</bug_when>
    <thetext>I am reopening this because the change is not backwards compatible.  If a 3.0 implementation currently extends the schema as described in comment 2, that schema is no longer be valid with the change described in comment 3.  The element declaration &quot;xindent&quot;, which would not be in the standard namespace [2], now causes a violation of the &quot;Unique Particle Attribution Constraint&quot; [1].  It falls under the case &quot;One is a wildcard and the other an element declaration, and the {target namespace} of any member of its ·substitution group· is ·valid· with respect to the {namespace constraint} of the wildcard&quot;.

[1] http://www.w3.org/TR/xmlschema-1/#non-ambig
[2] http://www.w3.org/2010/xslt-xquery-serialization</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123200</commentid>
    <comment_count>5</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2015-09-15 02:42:09 +0000</bug_when>
    <thetext>One possible way forward is to describe differently the way validation is performed on the parameters.  

If I&apos;m reading the spec and our overall goals right, we want the effect of the rules to be:  if a serialization parameter defined in our spec is used, it should be valid against the definition in the spec (including the schema), but it&apos;s legitimate to have other serialization parameters, not defined in the spec.

(The PSVI is designed to provide just the information needed here, with a simple validation against the schema as given in the spec:  unrecognized parameters will cause the output:serialization-parameters element to be invalid, but the individual parameters will be valid or invalid, and recorded as such.  We cannot use that property here, though, because XQuery and XSLT both made the design error of confusing invalidity against a schema with an unconditional error condition, and our validation actions never return the PSVI if the validation root is invalid.  It was a mistake to define our validation primitives this way, and we are now reaping the reward of that design mistake.  And I would like to redeem my I-told-you-so chit now.)

We can work around the problem by changing the rule to say NOT:  validate the output:serialization-parameters element, and then raise an error if one of the parameters defined in the spec is invalid, but instead:  validate each child of output:serialization-parameters individually, against the schema in the spec, and raise an error if any of them are invalid.  Parameters not defined in the spec will not be valid, but they also won&apos;t be invalid:  they will have validity = notKnown.  

(Unless, of course, our validation routines also treat notKnown as equivalent to invalid, in which case we must say to raise an error if any parameter defined in the spec is invalid.)

So for 

  (validate lax { document { . } })
     /output:serialization-parameters
     /output:*[local-name() eq $param-name]/data(@value)

we should (I think) read

  (validate lax { document { ./output:serialization-parameters
     /output:*[local-name() eq $param-name] } })
     /data(@value)

and for

  &lt;xsl:sequence&gt;
    &lt;xsl:variable name=&quot;validated-instance&quot;&gt;
      &lt;xsl:document validation=&quot;lax&quot;&gt;
        &lt;xsl:sequence select=&quot;.&quot;/&gt;
      &lt;/xsl:document&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:sequence select=&quot;$validated-instance
                          /output:serialization-parameters
                          /output:*[local-name() eq $param-name]/data(@value)&quot;/&gt;
  &lt;/xsl:sequence&gt;

we should read

  &lt;xsl:sequence&gt;
    &lt;xsl:variable name=&quot;validated-instance&quot;&gt;
      &lt;xsl:document validation=&quot;lax&quot;&gt;
        &lt;xsl:sequence select=&quot;./output:serialization-parameters
                          /output:*[local-name() eq $param-name]&quot;/&gt;
      &lt;/xsl:document&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:sequence select=&quot;$validated-instance
                          /data(@value)&quot;/&gt;
  &lt;/xsl:sequence&gt;

I apologize that I have not worked through the underbrush of the QT specs&apos; descriptions of schema validation to see whether there are any other gotchas.  I intended to but am out of time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123207</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-09-15 15:54:29 +0000</bug_when>
    <thetext>Discussion suggested we might simplify this to

document{.}/
  output:serialization-parameters/
  (validate lax{output:*[local-name()=$param-name]})</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123256</commentid>
    <comment_count>7</comment_count>
    <who name="Andrew Coleman">andrew_coleman</who>
    <bug_when>2015-09-18 11:50:03 +0000</bug_when>
    <thetext>The WG decided to adopt the proposal in comment #5 with the modification in #6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123668</commentid>
    <comment_count>8</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2015-10-13 00:04:53 +0000</bug_when>
    <thetext>The changes suggested have been made and the editors&apos; draft has been updated accordingly.  (That draft will, in due course, be made public, but I don&apos;t
know where; if anyone wishes to inspect this change but currently lacks access
to the editors&apos; draft at [1], I will be happy to post a detailed list of the changes here.)

[1] https://www.w3.org/XML/Group/qtspecs/specifications/xslt-xquery-serialization-31/html/Overview-diff.html (member-only link)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>