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

RE: XSLT 2.0 and lazy evaluation

Subject: RE: XSLT 2.0 and lazy evaluation
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 3 Dec 2006 23:57:50 -0000
xslt evaluate
> Does XSLT 2.0 implement lazy evaluation?

That's entirely at the discretion of the processor.
>
> I ask this because the following example returned 4 in XSLT
> 1.0 but generates an error in XSLT 2.0 processors.

3 div 0 used double arithmetic in 1.0 and generated +INF. In 2.0 it uses
decimal arithmetic and generates a divide-by-zero error. This is one of
those documented incompatibilities which you can avoid if you leave
version="1.0" to run in backwards compatibility mode.

It's true that a processor might not evaluate $y and therefore might not
raise the error. That's equally true of 1.0 and 2.0 (the difference is that
in 1.0 there's no error here). However, with an expression that can be
evaluated at compile time, lazy evaluation doesn't seem a particularly
sensible strategy.

Michael Kay
http://www.saxonica.com/

>
> <xsl:stylesheet
>
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>         version="2.0">
>
> <xsl:template match="/">
>  <xsl:call-template name="f">
>   <xsl:with-param name="x" select="2" />
>   <xsl:with-param name="y" select="3 div 0" />
> </xsl:call-template> </xsl:template>
>
> <xsl:template name="f">
>  <xsl:param name="x" />
>  <xsl:param name="y" />
>  <xsl:value-of select="$x + $x" />
> </xsl:template>
>
> </xsl:stylesheet>
>
>
>
>
>
> ______________________________________________
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y msviles desde 1 cintimo por minuto.
> http://es.voice.yahoo.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-2007 All Rights Reserved.