Re: [xsl] function-available() test on stylesheet functions

Subject: Re: [xsl] function-available() test on stylesheet functions
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 17 Jul 2007 23:15:43 +0200
John McGowan wrote:

When calling function-available() inside of a use-when attribute it will never return true for a user defined function. The specs pretty much say this exactly.

A new try, I had some coffee now ;)
I looked it up in my projects, because I remember I had a similar problem. Actually, we included some helper functions for diagnosis when in a debug environment. Instead of writing tedious xsl:if/when/otherwise constructs, we defined several system properties, mainly to determine the context (debug, analysis, test, production) the stylesheets were used.


Now we could write something like:

<xsl:value-of select="myfun:analyze-this(....)" use-when="system-property('context') = 'debug'" />

Or, if you fancy that (not to everyone's taste), add it to you doctype and do:

<xsl:value-of select="myfun:analyze-this(....)" use-when="&debug;" />


Not sure this (again) addresses your problem domain, but it could be used to bring a (group of) stylesheet functions into the use-when and can even be used on xsl:import etc.


Cheers,
-- Abel Braaksma

Current Thread