[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Question on grouping and streaming in XSLT 3: difference between Saxon 9.6 EE and online version of Exselt


Subject: [xsl] Question on grouping and streaming in XSLT 3: difference between Saxon 9.6 EE and online version of Exselt
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 17 Jan 2015 10:35:10 -0000

I am trying to explore the use of streaming with various grouping approaches, mainly with Saxon 9.6 EE, but for comparison I also run examples through the online version of Exselt http://exselt.net/demo.

So far, when I used <xsl:mode streamable="yes"/> to make the whole code use streaming Saxon threw an error on stylesheet compilation if a construct or expression breaking streamability rules was used (for instance "The group-adjacent expression is not motionless").

However with a test case using

group-starting-with="record[foo = 'a']"

Saxon does compile the stylesheet but then gives various warnings during the execution that " SXST0061: An error occurred matching pattern {record[foo = 'a']}: Navigation using child axis is not supported from a streamed input node". and produces a wrong transformation result.

I understand the problem with that pattern and the "foo" child axis access but I wonder whether it should be found as an error during compilation, as in the other examples I tried.

Exselt does run the stylesheet and produces the wanted result but I have no way of seeing whether it built a tree or not.

Here are the samples, the stylesheet is

<xsl:stylesheet version="3.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="xs">

<xsl:mode streamable="yes"/>

<xsl:output indent="yes"/>

<xsl:template match="root">
<xsl:copy>
<xsl:for-each-group select="record" group-starting-with="record[foo = 'a']">
<group>
<xsl:copy-of select="current-group()"/>
</group>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>


</xsl:stylesheet>

an input sample is

<root>
  <record>
    <foo>a</foo>
    <bar>1</bar>
  </record>
  <record>
    <foo>b</foo>
    <bar>2</bar>
  </record>
  <record>
    <foo>a</foo>
    <bar>3</bar>
  </record>
  <record>
    <foo>b</foo>
    <bar>4</bar>
  </record>
  <record>
    <foo>a</foo>
    <bar>5</bar>
  </record>
  <record>
    <foo>a</foo>
    <bar>6</bar>
  </record>
  <record>
    <foo>c</foo>
    <bar>7</bar>
  </record>
</root>

the output I want is

<root>
   <group>
      <record>
         <foo>a</foo>
         <bar>1</bar>
      </record>
      <record>
         <foo>b</foo>
         <bar>2</bar>
      </record>
   </group>
   <group>
      <record>
         <foo>a</foo>
         <bar>3</bar>
      </record>
      <record>
         <foo>b</foo>
         <bar>4</bar>
      </record>
   </group>
   <group>
      <record>
         <foo>a</foo>
         <bar>5</bar>
      </record>
   </group>
   <group>
      <record>
         <foo>a</foo>
         <bar>6</bar>
      </record>
      <record>
         <foo>c</foo>
         <bar>7</bar>
      </record>
   </group>
</root>

the one Saxon 9.6 EE gives is

<root>
   <group>
      <record>
         <foo>a</foo>
         <bar>1</bar>
      </record>
      <record>
         <foo>b</foo>
         <bar>2</bar>
      </record>
      <record>
         <foo>a</foo>
         <bar>3</bar>
      </record>
      <record>
         <foo>b</foo>
         <bar>4</bar>
      </record>
      <record>
         <foo>a</foo>
         <bar>5</bar>
      </record>
      <record>
         <foo>a</foo>
         <bar>6</bar>
      </record>
      <record>
         <foo>c</foo>
         <bar>7</bar>
      </record>
   </group>
</root>

but as I said, with various warnings that something went wrong, of the form

Warning: on line 11 of test2015011607.xsl:
SXST0061: An error occurred matching pattern {record[foo = 'a']}: Navigation using child axis is not supported from a streamed input node



Current Thread