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

RE: question about identity transform

Subject: RE: question about identity transform
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 2 Nov 2006 16:31:15 -0000
RE:  question about identity transform
> From a user's perspective, how is it helpful 
> to make a distinction between processing order and result 
> order? 
> 
> I haven't implemented an XSLT processor, but when is this 
> distinction even useful, in practice?
> 

It's useful to remember that there is a distinction in the case of a
stylesheet that has side-effects. For example, if you do this:

<xsl:for-each select="//in">
  <out pos="{position()}"/>
  <xsl:message select="[{position()}]"/>
</xsl:for-each>

then the result tree is guaranteed to contain 

<out pos="1"/><out pos="2"/><out pos="3"/><out pos="4"/>...

but the message output might be

[12][9][3][7]...

Similarly, if you do

<xsl:for-each select="//in">
  <xsl:result-document href="x{position()}.xml">zzz</xsl:result-document>
  <xsl:if test="position() = 5">
  	<xsl:message terminate="yes">BANG</xsl:message>
  </xsl:if>
</xsl:for-each>

then there is no guarantee that you have written documents x1, x2, x3, and
x4 when you stop; you might have written x12, x9, x3, and x7 (or any other
subset of the result you would have got without the "terminate").

Optimizers are gradually getting smarter, and the smarter they get, the more
likely it is that this kind of thing will hit you.

Michael Kay
http://www.saxonica.com/

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-2007 All Rights Reserved.