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

Saxon bug in short-circuiting of expressions?

Subject: Saxon bug in short-circuiting of expressions?
From: "Michael(tm) Smith" <smith@xxxxxxxxxxxxxxxxxx>
Date: Mon, 24 Jul 2006 12:08:05 +0200
saxon murphy
I have a question about a difference in the way that Saxon handles
evaluation of calls to unknown functions in boolean expressions.

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>

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

I know that the "Forwards-Compatible Processing" section of the
XSLT 1.0 spec mentions that if an

  expression calls a function with an unprefixed name that is not
  part of the XSLT library, then an error must not be signaled
  unless the function is actually called.

But I'd think that Saxon would just short-circuit the expression,
never getting to actually evaluating the right operand -- the call
to the hoge() function -- since the XPath spec says:

  An and expression is evaluated by evaluating each operand and
  converting its value to a boolean as if by a call to the boolean
  function. The result is true if both values are true and false
  otherwise. The right operand is not evaluated if the left
  operand evaluates to false.

In this case, function-available('hoge') evaluates to false, so it
seems like the call to hoge() should not be getting evaluated.

Or am I misreading the spec?


Current Thread


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.
First Name
Last Name
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.