Update test merge-049 following spec changes
authorMichael Kay <mike@saxonica.com>
Thu, 09 Jul 2015 11:19:59 +0100
changeset 1011 9f4cd1a0f8c2
parent 1010 0fe29e4a403a
child 1012 6ba26e572cb6
Update test merge-049 following spec changes
tests/insn/merge/_merge-test-set.xml
tests/insn/merge/merge-049.xsl
--- a/tests/insn/merge/_merge-test-set.xml	Tue Jul 07 16:58:13 2015 +0100
+++ b/tests/insn/merge/_merge-test-set.xml	Thu Jul 09 11:19:59 2015 +0100
@@ -724,6 +724,7 @@
          xsl:merge: merge two documents with validation=strict
       </description>
       <created by="Michael Kay" on="2014-04-10"/>
+      <modified by="Michael Kay" on="2015-07-08" change="Bug 28762 means merging on position() no longer makes sense"/>
       <environment ref="merge049"/>
       <test>
          <stylesheet file="merge-049.xsl"/>
@@ -731,7 +732,7 @@
       </test>
       <result>
          <all-of>
-           <assert>count(/books/ok) = 4</assert>
+           <assert>count(/books/ok) = 3</assert>
            <assert>count(/books/bad) = 0</assert>
          </all-of>  
       </result>
--- a/tests/insn/merge/merge-049.xsl	Tue Jul 07 16:58:13 2015 +0100
+++ b/tests/insn/merge/merge-049.xsl	Thu Jul 09 11:19:59 2015 +0100
@@ -4,6 +4,10 @@
     exclude-result-prefixes="xs"
     version="3.0">
     
+    <xsl:variable name="cat-key" as="map(*)"
+      select="map{'MMP':1, 'P':2, 'H':3}"/>
+        
+    
     <!-- xsl:merge with two homogenous files and validation="strict" -->
     <xsl:output method="xml" indent="no"/>
     <xsl:import-schema schema-location="books.xsd"/>
@@ -13,7 +17,7 @@
                 <xsl:merge-source for-each-stream="'books1.xml', 'books2.xml'"
                 	select="BOOKLIST/BOOKS/ITEM"
                 	validation="strict">
-                        <xsl:merge-key select="position()"/>
+                        <xsl:merge-key select="$cat-key(@CAT)"/>
                 </xsl:merge-source>
                 <xsl:merge-action>
                    <xsl:choose>