[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Can I use a boolean variable in an xsl:if test
> <!-- Don't show if time is one minute --> > <xsl:variable name="show"> > <xsl:value-of select = "$time != 60000" /> > </xsl:variable> [snip] > <xsl:if test="$show"> > <noshow><xsl:value-of select = "$show" /></noshow> </xsl:if> > > </xsl:template> Here you want: <xsl:variable name="show" select="$time != 60000" /> Whenever you define a variable with no select statement (i.e. it has child content) : <xsl:variable name="show"> ... </xsl:variable> ...the variable has a type of 'tree' (result tree fragment). What you are doing above is testing if the tree is true or false, and a tree is true if it is non-empty. So, your $show variable above contains a tree with a root node and single text node with the value 'false', which makes it true :) By using the select attribute the result of the expression is bound to the variable, giving the variable a type of boolean (and not RTF) which is what you are after. Cheers andrew
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|