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

RE: Saxon bug in short-circuiting of expressions?

Subject: RE: Saxon bug in short-circuiting of expressions?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 24 Jul 2006 13:57:21 +0100
xsl short condition
> Applying the following stylesheet to itself or on any other 
> instance, I'd expect it would produce no errors and no output.
> 
>   <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>     <xsl:output method="text"/>
>     <xsl:template match="/">
>       <xsl:if test="function-available('hoge') and 
> hoge()">moge</xsl:if>
>     </xsl:template>
>   </xsl:stylesheet>
> 
> If I try it with xsltproc, that is exactly what I get (no 
> errors, no output). But trying it with Saxon, I get a fatal error:
> 
>   Error in expression function-available('hoge') and hoge(): 
> Unknown system function: hoge

The function hoge() is not in a namespace. Therefore it has to be a system
function, not an extension function. Referring to a system function that
doesn't exist is a static error, that is, it doesn't depend on whether the
function call is actually executed or not. The sentence I quoted from XSLT
1.0 section 14.2:

"An XSLT processor must not signal an error merely because an expression
contains an extension function for which no implementation is available."

refers explicitly to extension functions, defined by: "If a FunctionName in
a FunctionCall expression is not an NCName (i.e. if it contains a colon),
then it is treated as a call to an extension function."

For system functions the relevant statement is at the end of section 4:

"the function library consists of the core function library together with
the additional functions defined in [12 Additional Functions] and extension
functions as described in [14 Extensions]; it is an error for an expression
to include a call to any other function"

The 1.0 spec doesn't make a very clear distinction between static and
dynamic errors, but the text makes it fairly clear that it is describing a
static condition (an expression including a particular function call) rather
than a dynamic condition (the call being evaluated).

However, if you change the xsl:stylesheet element to say version="2.0", then
forwards compatibility comes into play, and no error is reported, because of
the rule that you originally quoted.

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.