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

Re: Order of call-template

Subject: Re: Order of call-template
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Fri, 22 Jun 2012 17:42:30 +0100
Re:  Order of call-template
There is a very high likelihood that any XSLT processor will execute these instructions in the order you write them, but it's not guaranteed by the spec. For example, they could be executed in parallel. The only guarantee in the spec is that in the result sequence, <outcode> and its contents will precede <incode> and its contents.

Where processors ARE very likely to muck around with the ordering is when you use variables. If you wrote

<xsl:variable name="i">
<incode>
<xsl:call-template name="getIncode">
<xsl:with-param name="zip" select="'10001'"/>
<xsl:with-param name="id" select="2"/>
</xsl:call-template>
</incode>
</xsl:variable>

<xsl:variable name="o">
<outcode>
<xsl:call-template name="getOutcode">
<xsl:with-param name="zip" select="'10001"/>
<xsl:with-param name="id" select="1"/>
</xsl:call-template>
</outcode>
</xsl:variable>

<xsl:copy-of select="$o, $i"/>

Then you might well find different processors using a different order of execution. Of course, the only way you can tell is if the templates have side-effects (for example, if they call xsl:message).

Michael Kay
Saxonica




On 22/06/2012 17:07, Ming Yu wrote:
I have the following code in my xslt. Will it guarantee the first call-template to be executed before the second one?

<outcode>
<xsl:call-template name="getOutcode">
<xsl:with-param name="zip" select="'10001"/>
<xsl:with-param name="id" select="1"/>
</xsl:call-template>
</outcode>
<incode>
<xsl:call-template name="getIncode">
<xsl:with-param name="zip" select="'10001'"/>
<xsl:with-param name="id" select="2"/>
</xsl:call-template>
</incode>

Thanks!

Ming

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.