यदि कथन का उपयोग केवल एक स्थिति को जल्दी से जांचने के लिए किया जाता है। जब आपके पास कई विकल्प हों, तो <xsl:choose>
नीचे दिए गए उदाहरण के रूप में उपयोग करें:
<xsl:choose>
<xsl:when test="$CreatedDate > $IDAppendedDate">
<h2>mooooooooooooo</h2>
</xsl:when>
<xsl:otherwise>
<h2>dooooooooooooo</h2>
</xsl:otherwise>
</xsl:choose>
इसके अलावा, आप नीचे दिए गए उदाहरण के रूप में <xsl:when>
व्यक्त If .. Else If
या Switch
पैटर्न के लिए कई टैग का उपयोग कर सकते हैं :
<xsl:choose>
<xsl:when test="$CreatedDate > $IDAppendedDate">
<h2>mooooooooooooo</h2>
</xsl:when>
<xsl:when test="$CreatedDate = $IDAppendedDate">
<h2>booooooooooooo</h2>
</xsl:when>
<xsl:otherwise>
<h2>dooooooooooooo</h2>
</xsl:otherwise>
</xsl:choose>
पिछला उदाहरण नीचे दिए गए छद्म कोड के बराबर होगा:
if ($CreatedDate > $IDAppendedDate)
{
output: <h2>mooooooooooooo</h2>
}
else if ($CreatedDate = $IDAppendedDate)
{
output: <h2>booooooooooooo</h2>
}
else
{
output: <h2>dooooooooooooo</h2>
}