RE: [XSLT 2.0] Why doesn't XSLT have an <xsl:else> element?

How would you associate the <xsl:else> with the <xsl:if>? Perhaps by
wrapping both of them in an <xsl:choose>?
 
XSLT has <xsl:if> for a "one-way" conditional, and <xsl:choose> for a
"multi-way". Surely that's quite enough?
 
Michael Kay 


A few days ago I was asked the question as to why XSLT doesn't have an
<xsl:else> element associated with an <xsl:if> element. I didn't have an
explanation that seemed to me to be compelling.

Is there a good reason for the absence of <xsl:else>?

I am not asking if there is a workaround. I can think of a couple in XSLT
1.0 and three in XSLT 2.0. 

The question is why isn't there an <xsl:else> element available? 

I suppose the implicit possible follow up question, depending on the weight
of the answer to the first question, is why don't we add an <xsl:else>
element to XSLT 2.0?

Andrew Watt 

Received on Thursday, 1 April 2004 10:55:34 UTC