adding extra match test on numeric sequence, fix _match-test-set.xml for catalog schema
authorabraaksm
Thu, 26 Mar 2015 13:13:51 +0100
changeset 862 6f9cd1f7ac08
parent 861 ccf8d03b8d65
child 863 8a52ecfb8ae0
child 864 12fbfd9f31af
adding extra match test on numeric sequence, fix _match-test-set.xml for catalog schema
tests/attr/match/_match-test-set.xml
tests/attr/match/match-241.xsl
--- a/tests/attr/match/_match-test-set.xml	Thu Mar 26 13:05:13 2015 +0100
+++ b/tests/attr/match/_match-test-set.xml	Thu Mar 26 13:13:51 2015 +0100
@@ -4417,8 +4417,8 @@
       </dependencies>
       <test>
          <stylesheet file="match-240.xsl"/>
-         <initial-template name="main"/>
-         <param name="N" select="1"/>
+         <param name="N" select="1"/>         
+         <initial-template name="main"/>         
       </test>
       <result>
          <assert-xml><![CDATA[<out><second><first>17</first></second></out>]]></assert-xml>
@@ -4434,8 +4434,8 @@
       </dependencies>
       <test>
          <stylesheet file="match-240.xsl"/>
+         <param name="N" select="2"/>
          <initial-template name="main"/>
-         <param name="N" select="2"/>
       </test>
       <result>
          <assert-xml><![CDATA[<out><first>17</first></out>]]></assert-xml>
@@ -4451,8 +4451,8 @@
       </dependencies>
       <test>
          <stylesheet file="match-240.xsl"/>
+         <param name="N" select="true()"/>
          <initial-template name="main"/>
-         <param name="N" select="true()"/>
       </test>
       <result>
          <assert-xml><![CDATA[<out><second><first>17</first></second></out>]]></assert-xml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/match/match-241.xsl	Thu Mar 26 13:13:51 2015 +0100
@@ -0,0 +1,35 @@
+<?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"
+    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>
+
+    <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 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:stylesheet>