Test a predicate pattern that is not motionless
authorMichael Kay <mike@saxonica.com>
Tue, 08 Aug 2017 17:54:04 +0100
changeset 1735 2d07e517a7e9
parent 1734 204d3d3291fd
child 1736 5d237a457819
Test a predicate pattern that is not motionless
tests/attr/streamable/_streamable-test-set.xml
tests/attr/streamable/streamable-142.xsl
--- a/tests/attr/streamable/_streamable-test-set.xml	Tue Aug 08 17:52:59 2017 +0100
+++ b/tests/attr/streamable/_streamable-test-set.xml	Tue Aug 08 17:54:04 2017 +0100
@@ -2732,4 +2732,19 @@
          <error code="XTSE3430"/>
       </result>
    </test-case>
+   
+   <test-case name="streamable-142">
+      <description>A predicate pattern that is not motionless</description>
+      <created by="Michael Kay" on="2017-08-08"/>
+      <environment>
+         <source role="." file="streamable-140.xml" streaming="true"/>
+      </environment>
+      <test>
+         <stylesheet file="streamable-142.xsl"/>
+      </test>
+      <result>
+         <error code="XTSE3430"/>
+      </result>
+   </test-case>
+   
 </test-set>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/streamable/streamable-142.xsl	Tue Aug 08 17:54:04 2017 +0100
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  xmlns:math="http://www.w3.org/2005/xpath-functions/math" exclude-result-prefixes="xs math" 
+  expand-text="true" version="3.0">
+  
+  <xsl:param name="STREAMABLE" as="xs:boolean" static="yes" select="true()"/>
+  
+  <xsl:mode _streamable="{$STREAMABLE}" on-no-match="shallow-copy"/>
+  
+  <xsl:output indent="yes"/>
+  
+  <xsl:template match="Record">
+    <xsl:copy>
+      <xsl:for-each-group select="tokenize(., '\r?\n')[normalize-space()]" 
+        group-starting-with=".[starts-with(., ':A:')]">
+        <Detail>
+          <FieldA>{replace(., ':A:', '')}</FieldA>
+          <Trans>
+            <xsl:apply-templates select="current-group()[position() gt 1]"/>
+          </Trans>
+        </Detail>
+      </xsl:for-each-group>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match=".[starts-with(., ':B:')]"> <!-- NOT  MOTIONLESS -->
+    <Group>
+      <FieldB>{replace(., ':B:', '')}</FieldB>
+    </Group>
+  </xsl:template>
+  
+</xsl:stylesheet>
\ No newline at end of file