Q:

XSL Basics: showing value of a boolean?

When I have this in xsl:
<xsl:choose>
  <xsl:when test="something > 0">
    <xsl:variable name="myVar" select="true()"/>
  </xsl:when>
  <xsl:otherwise>
    <xsl:variable name="myVar" select="false()"/>
  </xsl:otherwise>
</xsl:choose>

How can I then print out the value of "myVar"? Or more importantly, how can I use this boolean in another choose statement?

A:

<xsl:choose>
  <xsl:when test="something > 0">
    <xsl:variable name="myVar" select="true()"/>
  </xsl:when>
  <xsl:otherwise>
    <xsl:variable name="myVar" select="false()"/>
  </xsl:otherwise>
</xsl:choose>

This is quite wrong and useless, because the variable $myVar goes out of scope immediately.
One correct way to conditionally assign to the variable is:
<xsl:variable name="myVar">
  <xsl:choose>
    <xsl:when test="something > 0">1</xsl:when>
    <xsl:otherwise>0</xsl:otherwise>
  </xsl:choose>
</xsl:variable>

However, you really don't need this  -- much simpler is:
<xsl:variable name="myVar" select="something > 0"/>

How can I then print out the value of "myVar"?

Use:
<xsl:value-of select="$myVar"/>

Or more importantly, how can I use this boolean in another choose
  statement?

Here is a simple example:
<xsl:choose>
  <xsl:when test="$myVar">
   <!-- Do something -->
  </xsl:when>
  <xsl:otherwise>
   <!-- Do something else -->
  </xsl:otherwise>
</xsl:choose>

And here is a complete example:
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>

 <xsl:template match="/*/*">
  <xsl:variable name="vNonNegative" select=". >= 0"/>

  <xsl:value-of select="name()"/>: <xsl:text/>

  <xsl:choose>
   <xsl:when test="$vNonNegative">Above zero</xsl:when>
   <xsl:otherwise>Below zero</xsl:otherwise>
  </xsl:choose>
 </xsl:template>
</xsl:stylesheet>

when this transformation is applied on the following XML document:
<temps>
 <Monday>-2</Monday>
 <Tuesday>3</Tuesday>
</temps>

the wanted, correct result is produced:
 Monday: Below zero
 Tuesday: Above zero

