Project

Profile

Help

Streamable XSLT attempt passes streamability analysis, gives warning "bytecode(consume(xsl:apply-templates)) is not fully streamed" but then gives different result when run without streaming

Added by Martin Honnen over 2 years ago

Playing with some code to see which errors during streamed processing xsl:try/xsl:catch could catch I wrote the code

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="3.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="#all"
  expand-text="yes">

  <xsl:output method="xml" indent="yes"/>

  <xsl:mode on-no-match="shallow-copy" streamable="yes"/>

  <xsl:template match="/">
    <xsl:try>
      <xsl:apply-templates/>
      <xsl:catch/>
    </xsl:try>
  </xsl:template>

</xsl:stylesheet>

When I run this against a sample input like

<?xml version="1.0" encoding="utf-8"?>
<root><section><title>s1</title></section><section><title>s2</title></section></root>

Saxon 10.6 EE Java gives a warning

Warning on line 14 column 29 of streamed-identity-plus-indentation-with-try-catch.xsl:
  SXST0067  Execution of bytecode(consume(xsl:apply-templates)) is not fully streamed

but then runs the code and gives an output different to a non-streamed execution where it seems text nodes are output after the document:

<?xml version="1.0" encoding="UTF-8"?>
<root>
   <section>
      <title/>
   </section>
   <section>
      <title/>
   </section>
</root>s1s2

The expected output would be

<?xml version="1.0" encoding="UTF-8"?>
<root>
   <section>
      <title>s1</title>
   </section>
   <section>
      <title>s2</title>
   </section>
</root>

SaxonCS-EE 11.0 gets it right even with streaming.


    (1-1/1)

    Please register to reply