Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] question about identity transform

From: "Michael Kay" <mike@------------>
To:
Date: 11/2/2006 4:32:00 PM
> 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent