Merge (solved several conflicts, will also need next commit for missing files)
authorabraaksm
Thu, 26 Mar 2015 13:05:13 +0100
changeset 861 ccf8d03b8d65
parent 860 69130abe2b48 (current diff)
parent 853 5d41f53338a6 (diff)
child 862 6f9cd1f7ac08
Merge (solved several conflicts, will also need next commit for missing files)
tests/attr/match/_match-test-set.xml
tests/attr/match/match-132.xsl
tests/attr/match/match-239.xsl
tests/decl/accumulator/_accumulator-test-set.xml
tests/decl/accumulator/accumulator-044.xsl
--- a/tests/attr/match/_match-test-set.xml	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/attr/match/_match-test-set.xml	Thu Mar 26 13:05:13 2015 +0100
@@ -1650,6 +1650,7 @@
       <description>Test parens at top level of pattern, allowed in 3.0</description>
       <keywords>not-XTSE0340 not-XPST0017 UnionExpr ParenthesizedExpr</keywords>
       <created by="Michael Kay" on="2013-06-18"/>
+      <modified by="Michael Kay" on="2015-03-25" change="See bug 28335"/>
       <modified by="Abel Braaksma" on="2015-03-24" change="Bug 28335, fix XSLT version in stylesheet and multiple-match issue (parens do not change priority)" />
       <environment ref="match1059"/>
       <dependencies>
@@ -2524,9 +2525,10 @@
    </test-case>
 
    <test-case name="match-132">
-      <description>Integer predicate in type pattern (rules unclear, see bug 12455)</description>
+      <description>Integer predicate in type pattern (rules were unclear, see bug 12455)</description>
       <keywords>PredicatePattern InstanceOfExpr xs:integer xpath-comments numeric-predicate</keywords>
       <created by="Michael Kay" on="2012-11-07"/>
+      <modified by="Michael Kay" on="2015-03-25" change="See bugs 28366 and 12455"/>
       <modified by="Abel Braaksma" on="2015-03-24" change="Bug 28336, fix non-matching numeric predicate in PredicatePattern"/>
       <dependencies>
          <spec value="XSLT30+"/>
@@ -4391,6 +4393,73 @@
    </test-case>
    
    <test-case name="match-239">
+      <description>PredicatePattern cannot be parenthesized</description>
+      <keywords>PredicatePattern</keywords>
+      <created by="Michael Kay" on="2015-03-25"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="match-239.xsl"/>
+         <initial-template name="main"/>
+      </test>
+      <result>
+         <error code="XTSE0340"/>
+      </result>
+   </test-case>
+   
+   <test-case name="match-240a">
+      <description>Predicate pattern in which a filter might be numeric or boolean</description>
+      <keywords>PredicatePattern numeric-predicate</keywords>
+      <created by="Michael Kay" on="2015-03-25"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="match-240.xsl"/>
+         <initial-template name="main"/>
+         <param name="N" select="1"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><second><first>17</first></second></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="match-240b">
+      <description>Predicate pattern in which a filter might be numeric or boolean</description>
+      <keywords>PredicatePattern numeric-predicate</keywords>
+      <created by="Michael Kay" on="2015-03-25"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="match-240.xsl"/>
+         <initial-template name="main"/>
+         <param name="N" select="2"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><first>17</first></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="match-240c">
+      <description>Predicate pattern in which a filter might be numeric or boolean</description>
+      <keywords>PredicatePattern numeric-predicate</keywords>
+      <created by="Michael Kay" on="2015-03-25"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="match-240.xsl"/>
+         <initial-template name="main"/>
+         <param name="N" select="true()"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><second><first>17</first></second></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="match-241">
       <description>PredicatePattern, multiple matches, same priority, sequence of integers, position and last functions</description>
       <keywords>PredicatePattern InstanceOfExpr xs:integer fn:position fn:last xsl:next-match on-multiple-match</keywords>
       <created by="Abel Braaksma" on="2015-03-24"/>
@@ -4398,7 +4467,7 @@
          <spec value="XSLT30+"/>
       </dependencies>
       <test>
-         <stylesheet file="match-239.xsl"/>
+         <stylesheet file="match-241.xsl"/>
       </test>
       <result>
          <assert-eq>"1^2 = 1 = 1*1, 2^2 = 4 = 2*2, 3^2 = 9 = 3*3, 5^2 = 25 = 5*5, 7^2 = 49 = 7*7, 13^2 = 169 = 13*13, 17^2 = 289 = 17*17, 19^2 = 361 = 19*19"</assert-eq>
--- a/tests/attr/match/match-132.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/attr/match/match-132.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -29,7 +29,6 @@
 
     <xsl:template match="(:a(:z:)a:) . (:b:) [. instance (:c:) of xs:integer](:d:)[2](:e:)">
         <!-- quote from spec: "A predicate with the numeric value 1 (one) always matches, and a predicate with any other numeric value never matches." -->
-        <!-- this template is not matched -->
         <should-not-match>
             <xsl:next-match />
         </should-not-match>
--- a/tests/attr/match/match-239.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/attr/match/match-239.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -3,33 +3,20 @@
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     exclude-result-prefixes="xs"
-    expand-text="true"
     version="3.0">
 
-    <?spec xslt#patterns?>
-    <!-- Purpose: numeric value of predicate.  -->
-    <!-- Purpose: multiple matches, atomic sequence, position and last functions  -->
-    
-    <xsl:template name="xsl:initial-template">
-        <xsl:apply-templates select="1, 2, 3, 5, 7, 13, 17, 19" />
-    </xsl:template>
-
-    <xsl:template match=".[. instance of xs:integer]">
-        <xsl:next-match />*<xsl:next-match />
-        <xsl:if test="position() != last()">, </xsl:if>
-    </xsl:template>
+<?spec xslt#patterns?>
+    <!-- Purpose: predicate pattern cannot be parenthesized.  -->
 
-    <xsl:template match=".[. instance of xs:integer]"> = <xsl:next-match /></xsl:template>
-
-    <xsl:template match=".[. instance of xs:integer]">{.*.}<xsl:next-match /></xsl:template>
-
-    <xsl:template match=".[. instance of xs:integer]"> = <xsl:next-match /></xsl:template>
+<xsl:template name="main">
+ <out>
+ 	<xsl:apply-templates select="17"/>
+ </out>
+</xsl:template>
 
-    <xsl:template match=".[. instance of xs:integer]">2<xsl:next-match /></xsl:template>
-
-    <xsl:template match=".[. instance of xs:integer]">^<xsl:next-match /></xsl:template>
 
-    <xsl:template match=".[. instance of xs:integer]">{.}<xsl:next-match /></xsl:template>
+<xsl:template match="(.[. instance of xs:integer])">
+  <first><wrong/></first>
+</xsl:template>
 
-    
 </xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/match/match-240.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<xsl:stylesheet 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="3.0">
+
+<?spec xslt#patterns?>
+    <!-- Purpose: predicate pattern in which the type is not known statically.  -->
+    <!-- Purpose: comments in a pattern.  -->
+
+<xsl:template name="main">
+ <out>
+ 	<xsl:apply-templates select="17"/>
+ </out>
+</xsl:template>
+
+
+<xsl:template match=".[. instance of xs:integer]" priority="5">
+  <first><xsl:next-match/></first>
+</xsl:template>
+
+<xsl:param name="N" required="yes"/>
+
+<xsl:template match=".[. instance of xs:integer][$N]" priority="10">
+  <second><xsl:next-match/></second>
+</xsl:template>
+
+
+</xsl:stylesheet>
--- a/tests/decl/accumulator/_accumulator-test-set.xml	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/_accumulator-test-set.xml	Thu Mar 26 13:05:13 2015 +0100
@@ -755,12 +755,19 @@
       <description>Compute a Histogram showing the Number of Books, by Publisher</description>
       <keywords>xsl:accumulator</keywords>
       <created by="Abel Braaksma / Eugene" on="2015-01-26"/>
+      <modified by="Michael Kay" on="2015-03-23" change="keys are untypedAtomic; sort results into predictable order"/> 
       <environment ref="accumulator-043"/>
       <test>
          <stylesheet file="accumulator-043.xsl"/>
       </test>
       <result>
-     	 <assert-xml><![CDATA[<histogram><publisher name="Modern Library">1</publisher><publisher name="Penguin Classics">2</publisher><publisher name="Bantam Classics">1</publisher><publisher name="Hodder &amp; Stoughton">1</publisher><publisher name="Penguin">1</publisher></histogram>]]></assert-xml>
+     	 <assert-xml><![CDATA[<histogram
+     	 ><publisher name="Bantam Classics">1</publisher
+     	 ><publisher name="Hodder &amp; Stoughton">1</publisher
+     	 ><publisher name="Modern Library">1</publisher
+     	 ><publisher name="Penguin">1</publisher
+     	 ><publisher name="Penguin Classics">2</publisher
+     	 ></histogram>]]></assert-xml>
       </result>
    </test-case>
 
@@ -768,6 +775,7 @@
       <description>Remember the Title of a Document</description>
       <keywords>xsl:accumulator fn:accumulator-before</keywords>
       <created by="Abel Braaksma / Eugene" on="2015-01-23"/>
+      <modified by="Michael Kay" on="2015-03-23" change="make select expression streamable"/>
       <modified by="Abel Braaksma" on="2015-03-23" change="Fix bug 28318"/>
       <environment ref="accumulator-044s"/>
       <dependencies>
--- a/tests/decl/accumulator/accumulator-005.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-005.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -6,6 +6,9 @@
   <!-- Get post-descent value of accumulator -->
   
   <xsl:param name="streamable" static="yes" select="'no'"/>
+  
+  <xsl:global-context-item _streamable="{$streamable}" use-accumulators="f:figNr"/>
+
 
   <xsl:accumulator name="f:figNr" as="xs:decimal" initial-value="0"
     _streamable="{$streamable}">
--- a/tests/decl/accumulator/accumulator-007.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-007.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -32,6 +32,8 @@
      <xsl:accumulator-rule match="transaction" select="if (@amount &gt; $value) then @amount else $value"/>
    </xsl:accumulator>
    
+   <xsl:global-context-item _streamable="{$streamable}" use-accumulators="#all"/>
+
    
    <xsl:mode _streamable="{$streamable}" on-no-match="deep-skip"/>
    <xsl:template match="/">
--- a/tests/decl/accumulator/accumulator-009.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-009.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -26,6 +26,7 @@
      <xsl:accumulator-rule match="transaction" select="if (@amount &gt; $value) then @amount else $value"/>
    </xsl:accumulator>
    
+   <xsl:global-context-item streamable="yes" use-accumulators="count sum min max"/>
    
    <xsl:mode streamable="yes" on-no-match="deep-skip"/>
    <xsl:template match="/">
--- a/tests/decl/accumulator/accumulator-010.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-010.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -12,7 +12,7 @@
     <xsl:accumulator-rule match="section" phase="end" select="tail($value) (:pop:)"/>
   </xsl:accumulator>
 
-
+  <xsl:global-context-item use-accumulators="#all"/>
   <xsl:mode _streamable="{$streamable}" on-no-match="shallow-copy"/>
 
   <xsl:template match="section">
--- a/tests/decl/accumulator/accumulator-012.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-012.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -14,7 +14,7 @@
     <xsl:accumulator-rule match="section/p/text()" select="string(.)"/>
   </xsl:accumulator>
 
-
+  <xsl:global-context-item use-accumulators="#all"/>
   <xsl:mode _streamable="{$streamable}" on-no-match="shallow-copy"/>
 
   <xsl:template match="section">
--- a/tests/decl/accumulator/accumulator-015.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-015.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -15,6 +15,8 @@
        <xsl:accumulator-rule match="cost/text()" select="$value + xs:integer(.)"/>
    </xsl:accumulator>
    
+   <xsl:global-context-item use-accumulators="item-cost"/>
+   
    <!-- The void xsl:for-each in the template below is designed to sow confusion. Although it does nothing useful,
      it still serves to separate the pre-descent and post-descent phases of the sequence constructor. -->
 
--- a/tests/decl/accumulator/accumulator-031.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-031.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -7,12 +7,14 @@
   
   <xsl:mode streamable="yes"/>
   
+  <xsl:global-context-item use="absent"/>
+  
   <xsl:accumulator name="a" as="xs:integer" initial-value="0" streamable="yes">
     <xsl:accumulator-rule match="*" select="$value + $count"/>
   </xsl:accumulator>
 
   <xsl:variable name="count">
-    <xsl:stream href="accumulator-001.xml">
+    <xsl:stream href="accumulator-001.xml" use-accumulators="#all">
       <xsl:for-each select="*"/>
       <xsl:value-of select="accumulator-after('a')"/>
     </xsl:stream>
--- a/tests/decl/accumulator/accumulator-034.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-034.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -9,6 +9,8 @@
   
   <xsl:mode _streamable="{$streamable}" on-no-match="shallow-skip"/>
   
+  <xsl:global-context-item use-accumulators="#all"/>
+  
   <xsl:accumulator name="a" as="xs:integer" initial-value="0" _streamable="{$streamable}">
     <xsl:accumulator-rule match="chap[not(@nr = $seven)]" select="0"/>
     <xsl:accumulator-rule match="fig[every $n in data(@*) satisfies $n = '83']" select="$value + 2"/>
--- a/tests/decl/accumulator/accumulator-035.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-035.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -25,4 +25,5 @@
   </xsl:template>
   
   <xsl:param name="zero" select="0"/>
+  <xsl:global-context-item use-accumulators="a"/>
 </xsl:stylesheet>
--- a/tests/decl/accumulator/accumulator-036.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-036.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -12,6 +12,9 @@
    <xsl:param name="streamable" static="yes"/>
 
    <xsl:mode _streamable="{$streamable}" />
+   
+   <xsl:global-context-item use-accumulators="#all"/>
+  
 
    <xsl:accumulator name="item-cost" _streamable="{$streamable}" 
        as="xs:integer" initial-value="0">
--- a/tests/decl/accumulator/accumulator-043.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-043.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -7,7 +7,7 @@
 >
 	<!-- Compute a Histogram showing the Number of Books, by Publisher
          The contained sequence constructor is evaluated with the variable $value set to the current value, and with the context node as the node being visited. -->
-	<xsl:accumulator name="histogram" as="map(xs:string, xs:integer)"
+	<xsl:accumulator name="histogram" as="map(xs:untypedAtomic, xs:integer)"
     	initial-value="map{}">
 	    <xsl:accumulator-rule match="ITEM">
     	  	<xsl:choose>
@@ -25,6 +25,7 @@
 		<histogram>
 			<xsl:variable name="map" select="accumulator-after('histogram')"/>
 			<xsl:for-each select="map:keys($map)">
+			    <xsl:sort select="."/>
 				<publisher name="{.}">
 					<xsl:value-of select="map:get($map, .)"/>
 				</publisher>
--- a/tests/decl/accumulator/accumulator-044.xsl	Thu Mar 26 12:43:31 2015 +0100
+++ b/tests/decl/accumulator/accumulator-044.xsl	Thu Mar 26 13:05:13 2015 +0100
@@ -8,6 +8,8 @@
     exclude-result-prefixes="xs"
 >
     <xsl:mode on-no-match="shallow-copy"/>
+    
+    <!-- from section 18.2.9 Examples of Accumulators -->
 	
     <!-- Remember the Title of a Document
 	    Consider an XHTML document in which the title of the document is represented by the content of the first title element appearing as a child of the head element,