Return to doc.sitecore.com

Valid for Sitecore 5.3.1
20.  Tristate
Prev Next

The value of the “Tristate” field is ‘1’ when “Yes” option is chosen in the Content Editor, ‘0’ when “No” is chosen and the field is blank when “Default” is set.

What you do with checkbox’s value in XSLT rendering depends on particular needs of your application. Normally you would use it in <xsl:if/> or <xsl:choose/> statements to implement conditional logic:

<xsl:variable name="active" select="sc:fld('My Tristate', .)"/>

<xsl:choose>

  <xsl:when test="$active = '1'">

    <p>The value of the Tristate is "Yes"</p>

  </xsl:when>

  <xsl:when test="$active = '0'">

    <p>The value of the Tristate is "No"</p>

  </xsl:when>

  <xsl:otherwise>

    <p>The value of the Tristate is "Default"</p>

  </xsl:otherwise>

</xsl:choose>


Prev Next