Conditional Processing

<xsl:if>

Simple conditional (no "else")

<xsl:if test="$somecondition">
  <xsl:text>this text only gets used if $somecondition is true()</xsl:text>
</xsl:if>
<xsl:choose>

Select among alternatives with <xsl:when> and <xsl:otherwise>

<xsl:choose>
  <xsl:when test="$count > 2"><xsl:text>, and </xsl:text></xsl:when>
  <xsl:when test="$count > 1"><xsl:text> and </xsl:text></xsl:when>
  <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
</xsl:choose>

To report errors, use <xsl:message>.

<xsl:message>
  <xsl:text>Error: no ID found for linkend: </xsl:text>
  <xsl:value-of select="@linkend"/>
  <xsl:text>.</xsl:text>
</xsl:message>