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(_dot_)fuller(_dot_)2007(_at_)gmail(_dot_)com]
Sent: 03 October 2007 14:59
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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> <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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--