test attribute null evaluation doesn 't work 2003-05-06 - By david_marston@(protected)
>This code evaluates to true when StartTime is not set. > <xsl:when test="$StartTime"> >I want it to evaluate to false. It worked fine in xalan-1.
And the variable was set by.... <xsl:variable name="StartTime"> <xsl:if test="..."> <xsl:value-of select="substring-before($TimeValues, ';')"/> </xsl:if> </xsl:variable>
This probably represents a required tightening-up between 1.x and 2.x. As you've structured it, $StartTime contains a result tree fragment (RTF), which you should read about in a good XSLT book. The RTF is never totally empty.
Fortunately, your case has the easy workaround of just inverting the structure: <xsl:if test="..."> <xsl:variable name="StartTime" select="..."/> </xsl:if> For more complicated situations, you could have a flag value that is outside the range of valid times, or you could have a second boolean variable $StartTimeSet to use in the xsl:when. .................David Marston
|
|