<?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>29887</bug_id>
          
          <creation_ts>2016-09-29 22:12:12 +0000</creation_ts>
          <short_desc>[XSLT30] Assertion on attributes of xsl:for-each-group is too strict, does not take shadow attribs into account</short_desc>
          <delta_ts>2016-10-13 21:38:47 +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>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="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>127609</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-09-29 22:12:12 +0000</bug_when>
    <thetext>This bug is courtesy of Charles Foster, he noticed it in a Skype chat.

In de XSD we have:

count((@group-by, @group-adjacent, @group-starting-with, @group-ending-with)) = 1

But this doesn&apos;t work with shadow-attributes. I propose something like the following should work (not tested):

count((
(@group-by|@_group-by)[1], 
(@group-adjacent|@_group-adjacent)[1], 
(@group-starting-with|@_group-starting-with)[1],
(@group-ending-with|@_group-ending-with)[1]
)) = 1

Rationale: if both the shadow- and normal attribute exists, the shadow attribute takes precedence. This also accounts for situations where you would end up with @_group-by and @group-ending-with appearing, which is wrong, because the first will end up after de-shadowing as @group-by.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127765</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-10-13 15:23:00 +0000</bug_when>
    <thetext>There are a few other cases of the same problem.

Line 180
&lt;xs:assert test=&quot;not(exists(@select) and (exists(* except xsl:fallback) or exists(text()[normalize-space()])))&quot;/&gt;

exists(@select) ==&gt; exists(@select|@_select)

Line 327, 690, 728, 1374
&lt;xs:assert test=&quot;every $e in subsequence(xsl:sort, 2) satisfies empty($e/@stable)&quot;&gt;

$e/@stable ==&gt; $e/(@stable|@_stable)

Line 371, 503, 530, 552, 615
&lt;xs:assert test=&quot;not(exists(@type) and exists(@validation))&quot;&gt;

==&gt; not(exists(@type|@_type) and exists(@validation|@_validation))

Line 737

count((@group-by, @group-adjacent, @group-starting-with, @group-ending-with)) = 1

==&gt; count((@group-by|@_group-by, @group-adjacent|@_group-adjcent, @group-starting-with|@_group-starting-with, @group-ending-with|@_group-ending-with)) = 1

(could use the comma operator throughout but it feels more expressive this way)

Line 746

if (exists(@collation) or exists(@composite)) then (exists(@group-by) or exists(@group-adjacent)) else true()&quot;

==&gt; as elsewhere, replace @X by @X|@_X

Line 807, 814, 821, 890, 

Line 1085
test=&quot;not(exists(@name) and normalize-space(@visibility) = &apos;private&apos; and exists(xsl:context-item))&quot;

this one is more tricky because it&apos;s looking at attribute values. But the rule is obsolete because xsl:mode no longer has an xsl:context-item child. Slightly surprised Saxon&apos;s static type checking lets that through.

line 1182
&lt;xs:assert test=&quot;every $prefix in (@stylesheet-prefix, @result-prefix)[. ne &apos;#default&apos;]
            satisfies $prefix = in-scope-prefixes(.)&quot;/&gt;

we can keep this as is.

line 1186
test=&quot;if (exists(@value)) then empty((@select, @count, @from)) and @level=&apos;single&apos; else true()&quot;&gt;
            
Usual @X by @X|@_X except that @level=&apos;single&apos; becomes (@level=&apos;single&apos; or @_level)

line 1134
&lt;xs:assert test=&quot;if (normalize-space(@static) = &apos;yes&apos;)
                           then empty((*,text()))
                           else true()&quot;&gt;
Leave as is.

etc. etc. All the remaining assertions fit into one of the above patterns.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127774</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-10-13 21:38:47 +0000</bug_when>
    <thetext>The schema has been updated and tested to fix these problems.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>