use-when expressions are evaluated at compile time, and the values of variables are not available until run-time. So you can't refer to variables from a use-when expression. Try referring to a Java system property instead:
 
<span xsl:use-when="system-property('isFeatured')='yes'">content</span>
 
and setting this from the command line
 
java -DisFeatured=yes net.sf.saxon.Transform...
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of max toro q
Sent: 25 April 2008 15:40
To: saxon-help@lists.sourceforge.net
Subject: [saxon] xsl:use-when

Hello Michael,
I was trying to use xsl:use-when but it is not finding a variable.
 
This works:
<xsl:if test="$is-featured">
   <span>content</span>
</xsl:if>
 
This doesn't:
<span xsl:use-when="$is-featured">content</span>
 
Saxon.Api.StaticError: Error in use-when expression. XPath syntax error at char 12 on line 224 in {$is-featured}:
   Variable $is-featured has not been declared
 
I'm using 9.0.0.2 on .net
 
--
Max