This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3772 - [XSLT 2.0] function-available cannot be used to detect extension functions
Summary: [XSLT 2.0] function-available cannot be used to detect extension functions
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-27 07:15 UTC by Colin Adams
Modified: 2006-10-24 10:47 UTC (History)
0 users

See Also:


Attachments

Description Colin Adams 2006-09-27 07:15:11 UTC
Section 18.1.1 claims that function-available() :
"can be used with the [xsl:]use-when attribute (see 3.12 Conditional Element Inclusion) to explicitly control how a stylesheet behaves if a particular extension function is not available."

But this appears not to be the case to me.
The static context at use-when time will not include the extension functions (unless the implementor has decided that 1 or more of them should be added to the in-scope functions. I assume that this is to make them available for evaluating use-when expressions, so many (all, I would have thought - certainly in the case of my implementation that is so) extension functions will not be present.

So function-available() will return false for these functions, even though they will be available at compile-time proper, and at runtime.

This makes function-available() completely useless within use-when expressions (the set of extension functions available at use-when processing time can be determined by calling system-property('xsl:vendor') and system-property('xsl:product-version').

I think that simply looking at the in-scope functions is not what function-available() should do - it should look at all the core and XSLT-added XPath functions, plus all the extension functions that will be available at compile-time proper (or runtime), and return true or false accordingly.
Comment 1 Michael Kay 2006-09-27 10:20:47 UTC
I think the spec makes an unstated assumption that an extension function is present in the static context for use-when if and only if it is present in the static context for the relevant part of the stylesheet. We should state this assumption.

Suggested wording: in 3.12, in the table for static context components, in the entry for in-scope functions, change "an implementation-defined set of extension functions" to "the set of extension functions that are present in the static context of every XPath expression (other than a use-when expression) within the content of the element that is the parent of the use-when attribute".

Also add a note: this ensures that function-available returns true in respect of extension functions that can be called within the scope of the use-when attribute. It also has the effect that these extension functions will be recognized within the use-when attribute itself; however, the fact that a function is available gives no guarantee that a call on the function will succeed.
Comment 2 Michael Kay 2006-10-24 10:46:50 UTC
The change proposed in comment #1 was agreed by the WG on 4 Oct 2006. The spec has now been updated and the bug will therefore be closed.