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

RE: possible xalan error using function-available() an

Subject: RE: possible xalan error using function-available() and element-available()
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 3 Oct 2007 17:59:18 +0100
RE:  possible xalan error using function-available() an
Bugs in this area are not improbable - you're probably the first person who
has used function-available with a dynamically-constructed argument except
in test cases. The processor has to do a lot of work for this, like saving
the namespace context. (Your code doesn't seem to do anything special to
ensure that the prefix of the function name is one that's actually declared
in the stylesheet)

I've always assumed that the only reason for testing function-available()
was because you wanted to call the function, and since the function call has
to use a static name, there's no conceivable reason to use
function-available with a dynamic name. Perhaps I was wrong.

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

> -----Original Message-----
> From: James Fuller [mailto:james.fuller.2007@xxxxxxxxx] 
> Sent: 03 October 2007 14:59
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  possible xalan error using 
> function-available() and element-available()
> 
> simple xslt revealed a possible bug with Xalan (latest java version)
> 
> 
> a long time ago, I had a set of EXSLT (www.exslt.org) 
> coverage XSLT, which outputted a simple report ... with 
> Firefox 3.0 including a few EXSLT functions ... I dusted them off;
> 
> http://www.ruminate.co.uk/2007/09/testing-exslt-support.html
> 
> explains the process ... its, in a nutshell,  a single XSLT 
> sheet is run by an XSLT Processor and reports back what EXSLT 
> functions is supported by said XSLT Processor.
> 
> There seems to be an error thrown by Xalan when processing either
> function-available() or element-available() when the function 
> or element name is supplied as an xsl:variable
> 
> <xsl:template match="exslt:function">
>         <xsl:variable name="prefix" 
> select="../../../exslt:module/@prefix"/>
> 
> <xsl:variable name="funcname"><xsl:value-of 
> select="concat($prefix,':',@name)"/></xsl:variable>
>     <tr>
>         <td>&#160;<xsl:value-of select="$funcname"/></td>
>         <td>
>             <xsl:choose>
>                 <xsl:when 
> test="function-available(string($funcname))">
>                     <div class="good">Available</div>
>                 </xsl:when>
>                 <xsl:otherwise>
>                     <div class="bad">Not Available</div>
>                 </xsl:otherwise>
>             </xsl:choose>
>         </td>
>     </tr>
> </xsl:template>
> 
> the operative term is
> 
> function-available(string($funcname))
> 
> Works fine on some XSLT Procesors
> 
> Saxon
> http://www.webcomposite.com/result/saxon8-result.html
> 
> XSLT Proc
> http://www.webcomposite.com/result/xsltproc-result.html
> 
> and a very early version of xalan ...
> http://www.webcomposite.com/result/xalan-result.html
> 
> however, latest Xalan doesn't like $funcname, nor does it like
> string($funcname) in function-available().
> 
> throws an error related to XPath
> 
> Line #86; Column #72; XSLT Error
> (javax.xml.transform.TransformerException): Unknown error in XPath.
> 
> is this an issue with spec interpretation, a bug ... or 
> something else ?
> 
> tia, Jim Fuller

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.