|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Re: Benefits of xsl.sequence
> Why is <xsl:sequence select="$first + $second"/> more > efficient than <xsl:value-of select="$first + $second"/>? > > I can understand that math on atomic values ought to be more > efficient than math on text nodes, but is the benefits > something we can measure in any meaningful sense? They aren't the same thing, so comparing their efficiency is meaningless. * One instruction computes a number by adding two numbers. * The other computes a number by adding two numbers, converts the result to a string, and then wraps the string in a text node. If the latter is what you want to do, then use it. But if you only want the number, then converting it to a string and wrapping the string in a text node is a crazy waste of effort, especially if you then convert the result back to a number, which is something one sees all too often. Whether you can measure the difference depends entirely of course on how often you do it. But somehow I think that if the syntax were spelt out in full as <xsl:create-text-node select="string-join(string($first + $second), ' ')"/> then you wouldn't even consider it. You can't claim you are using xsl:value-of rather than xsl:sequence because it's shorter to write. You're using a complex construct where a simple one would do, and the only possible reason for that is ingrained habits from XSLT 1.0. 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
|






