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

RE: parameters in XSLT 2.0

Subject: RE: parameters in XSLT 2.0
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 8 Jun 2005 00:40:20 +0100
xslt 2.0 parameter
> First, am I right that if I use an "as" attribute of element() or 
> node() I am passing a reference to the original element or node, and 
> thus that this is an efficient operation?

In the examples below you are passing a reference. If you used xsl:copy-of
rather that xsl:sequence you would be creating a copy. 

The effect of using "as" on performance may be positive or negative. It may
cause the system to do run-time checks that would otherwise not be
performed. On the other hand, it gives the system compile-time information
that may be useful to perform optimizations. I would use it as widely as
possible because it speeds the development cycle and catches bugs more
efficiently, and not worry too much about any effect on performance.

> 
> Related, am I correct that these below are equivalent from a 
> processing 
> standpoint?
> 
> <xsl:variable name="foo" select="bar" as="element()"/>
> 
> <xsl:variable name="foo" as="element()">
>    <xsl:sequence select="bar"/>
> </xsl:variable>

Yes.
> 
> Finally, in general, under what conditions should one use tunnel 
> parameters?  I do a lot of parameter passing in my 
> stylesheets, though 
> the content of those parameters is typically fixed.
> 

Use them if A calls E via B, C, and D, and you want to get information from
A to E without cluttering the code of templates B, C, and D. The most likely
use-case for this is if you are reusing existing templates B, C, and D and
want to reuse them unchanged.

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