|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






