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

Re: streaming identity transformation

Subject: Re: streaming identity transformation
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 26 Jan 2015 12:38:56 -0000
Re:  streaming identity transformation
We have fixed this problem as part of the resolution of this bug:


Sorry, but the discussion contains a number of links to member-only email

Abel pointed out in the bug report that we had made unintentional changes with
the consequence that <xsl:apply-templates select="@*"/> was no longer
streamable. The fix we adopted changes the posture of the expression @* from
climbing to striding. Saxon 9.6 implements the "unintentional changes".

Of course, in XSLT 3.0 you no longer need the identity template. You can
instead write

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

A workaround for Saxon 9.6 is to apply-templates to copies of attributes made
using copy-of().

Michael Kay
+44 (0) 118 946 5893

On 25 Jan 2015, at 15:14, Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> 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
>  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


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.
First Name
Last Name
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.