tests/strm/sf-snapshot/sf-snapshot-A.xsl
author Michael Kay <mike@saxonica.com>
Sat, 30 Aug 2014 11:51:31 +0100
changeset 645 e80583b67464
child 1414 a140061c9684
permissions -rw-r--r--
Add more streaming tests for fn:snapshot()
645
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
     1
<xsl:transform version="3.0" 
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
     2
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
     3
    xmlns:map="http://www.w3.org/2005/xpath-functions/map"
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
     4
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
     5
    exclude-result-prefixes="map xs">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
     6
    
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
     7
    <xsl:variable name="RUN" select="true()" static="yes"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
     8
    <xsl:strip-space elements="*"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
     9
   
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    10
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    11
  <!-- within xsl:stream, use fn:snapshot(): climbing posture -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    12
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    13
  <xsl:template name="cy-003" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    14
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    15
      <xsl:stream href="../docs/transactions.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    16
        <xsl:variable name="atts" as="attribute(*)*">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    17
          <xsl:sequence select="snapshot(account/transaction[@value &lt; 0]/@value)"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    18
        </xsl:variable>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    19
        <xsl:copy-of select="data($atts)"/>  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    20
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    21
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    22
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    23
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    24
  <!-- within xsl:stream, use fn:snapshot(): climbing posture -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    25
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    26
  <xsl:template name="cy-004" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    27
    <xsl:variable name="extra" as="element()*">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    28
      <PRICE value="101"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    29
      <PRICE value="102"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    30
    </xsl:variable>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    31
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    32
      <xsl:stream href="../docs/transactions.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    33
        <xsl:variable name="atts" as="attribute(*)*">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    34
          <xsl:sequence select="snapshot((account/transaction[@value &lt; 0]/@value, $extra/@value))"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    35
        </xsl:variable>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    36
        <xsl:copy-of select="data($atts)"/> 
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    37
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    38
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    39
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    40
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    41
  <!-- within xsl:stream, use fn:snapshot(): striding posture, element nodes -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    42
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    43
  <xsl:template name="cy-005" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    44
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    45
      <xsl:stream href="../docs/books.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    46
        <xsl:sequence select="snapshot(/BOOKLIST/BOOKS/ITEM/PRICE)"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    47
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    48
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    49
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    50
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    51
  <!-- within xsl:stream, use fn:snapshot(): striding posture, text nodes -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    52
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    53
  <xsl:template name="cy-006" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    54
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    55
      <xsl:stream href="../docs/books.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    56
        <xsl:sequence select="snapshot(/BOOKLIST/BOOKS/ITEM/PRICE/text())"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    57
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    58
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    59
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    60
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    61
  <!-- within xsl:stream, use fn:snapshot(): striding posture, element nodes mixed with grounded elements -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    62
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    63
  <xsl:template name="cy-008" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    64
    <xsl:variable name="extra" as="element()*">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    65
      <PRICE>100.00</PRICE>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    66
      <PRICE>101.00</PRICE>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    67
    </xsl:variable>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    68
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    69
      <xsl:stream href="../docs/books.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    70
        <xsl:sequence select="snapshot(($extra, /BOOKLIST/BOOKS/ITEM/PRICE))"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    71
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    72
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    73
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    74
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    75
  <!-- within xsl:stream, use fn:snapshot(): descendant text nodes -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    76
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    77
  <xsl:template name="cy-009" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    78
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    79
      <xsl:stream href="../docs/books.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    80
        <xsl:sequence select="snapshot(//PRICE/text())"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    81
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    82
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    83
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    84
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    85
  <!-- within xsl:stream, use fn:snapshot(): whole document unchanged -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    86
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    87
  <xsl:template name="cy-011" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    88
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    89
      <xsl:stream href="../docs/books.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    90
        <head/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    91
        <xsl:sequence select="snapshot(.)"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    92
        <tail/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    93
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    94
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    95
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    96
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    97
  <!-- within xsl:stream, use fn:snapshot(): copy-namespaces=yes -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    98
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
    99
  <xsl:template name="cy-021" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   100
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   101
      <xsl:stream href="../docs/citygml.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   102
        <xsl:sequence select="snapshot(/*/*:description)"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   103
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   104
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   105
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   106
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   107
  <!-- within xsl:stream, use fn:snapshot(): copy-namespaces="yes", argument grounded and consuming -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   108
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   109
  <xsl:template name="cy-025" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   110
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   111
      <xsl:stream href="../docs/citygml.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   112
        <xsl:sequence select="snapshot(snapshot(/*/*:description))"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   113
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   114
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   115
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   116
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   117
  <!-- within xsl:stream, use fn:snapshot(): argument crawling and consuming, nested nodes -->
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   118
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   119
  <xsl:template name="cy-027" use-when="$RUN">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   120
    <out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   121
      <xsl:stream href="../docs/nested-numbers.xml">
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   122
        <xsl:sequence select="snapshot(descendant::n)"/>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   123
      </xsl:stream>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   124
    </out>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   125
  </xsl:template>
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   126
  
e80583b67464 Add more streaming tests for fn:snapshot()
Michael Kay <mike@saxonica.com>
parents:
diff changeset
   127
</xsl:transform>