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

RE: Re: Benefits of xsl.sequence

Subject: RE: Re: Benefits of xsl.sequence
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 30 Sep 2008 09:58:24 +0100
RE:  Re: Benefits of xsl.sequence
> Could the use of xsl:sequence be considered mostly an 
> uptimization issue? A lot of the functionality of 
> xsl:sequence is covered by xsl:copy-of, and we can make 
> sequences in e.g. variables directly like xsl:variable 
> name=x" select="(2, 5, 8)"/>?

If you're using atomic values, then xsl:copy-of and xsl:sequence produce the
same run-time effect. However, if the system doesn't know statically that
the input will be atomic values rather than nodes, then more code might be
generated for the xsl:copy-of case, because it is a more complex
instruction. (xsl:sequence is essentially a no-op - it's just a syntax
wrapper that presents an XPath expression as an XSLT instruction.) Also,
because xsl:copy-of has the potential to create new nodes, it can't be
optimized away quite as easily as xsl:sequence; for example a call to a
function that calls xsl:copy-of can't safely be moved out of a loop.

> 
> Is there anything in XSLT 2.0 we can only do using xsl:sequence?
> 

Yes: this is the only way that you can write a function (or indeed a
template) that returns references to existing nodes, as distinct from newly
constructed nodes. That's very important if you're doing graph-manipulation
operations like checking your data for cycles.

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.