tags:

views:

3262

answers:

4

Is this right for When 4 < 5 and 1 < 2 ?

<xsl:when test="4 &lt; 5 AND 1 &lt; 2" >
<!-- do something -->
</xsl:when>
+1  A: 

From XML.com:

Like xsl:if instructions, xsl:when elements can have more elaborate contents between their start- and end-tags—for example, literal result elements, xsl:element elements, or even xsl:if and xsl:choose elements—to add to the result tree. Their test expressions can also use all the tricks and operators that the xsl:if element's test attribute can use, such as and, or, and function calls, to build more complex boolean expressions.

Harper Shelby
+4  A: 

Not quite, the AND has to be lower-case.

<xsl:when test="4 &lt; 5 and 1 &lt; 2">
<!-- do something -->
</xsl:when>
phihag
+2  A: 

It does have to be wrapped in an <xsl:choose> since it's a when. And lowercase the "and".

<xsl:choose>
   <xsl:when test="4 &lt; 5 and 1 &lt; 2" >
   <!-- do something -->
   </xsl:when>
   <xsl:otherwise>
   <!-- do something else -->
   </xsl:otherwise>
</xsl:choose>
Aaron Palmer
A: 

According to msdn you can do it:

http://msdn.microsoft.com/en-us/library/ms256081%28VS.85%29.aspx

Also somne other great resource about writing conditions:

http://www.xml.com/pub/a/2003/04/02/trxml.html

Remus Stratulat