[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

streaming identity transformation

Subject: streaming identity transformation
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 25 Jan 2015 15:14:09 -0000
 streaming identity transformation
I am wondering how one would write the identity transformation template

<xsl:template match="@* | node()">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()"/>
  </xsl:copy>
</xsl:template>

in an XSLT 3.0 stylesheet supposed to work with streaming. The section http://www.w3.org/TR/xslt-30/#built-in-templates-shallow-copy in the XSLT 3.0 specification has a template

<xsl:template match="." mode="M">
  <xsl:copy validation="preserve">
    <xsl:apply-templates select="@*" mode="M"/>
    <xsl:apply-templates select="node()" mode="M"/>
  </xsl:copy>
</xsl:template>

and explains "A further reason for choosing this form is for streamability: this formulation is guaranteed-streamable".

However, when I try

<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:template match=".">
  <xsl:copy validation="preserve">
    <xsl:apply-templates select="@*"/>
    <xsl:apply-templates select="node()"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>

with Saxon 9.6 EE I get a compilation error saying:

Error at xsl:template on line 8 column 25 of test2015012505.xsl:
XTSE3430: Template rule is declared streamable but it does not satisfy the streamability rules.
* In a streaming apply-templates instruction, the select expression cannot select
ancestors or attributes (that is, it must not have climbing posture)


So how would one write a template doing a shallow copy and then processing any attribute and child nodes in a streaming way?

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.