XSL Noob
XSL Noob

Reputation: 51

XSLT. Two possible output values, multiple if statements. Is there a way to do this?

I have two possible values that I can output "A" and "B"

The problem that I am having is that for output "A", it has to satisfy 3-4 conditions, otherwise return "B". I tried using but I cannot figure it out.

I tried doing something like below

<xsl:if>Cond1
<xsl:if>Cond2
<xsl:if>Cond3
</xsl:if>
</xsl:if>
A
</xsl:if>
B

But this just returns both A and B if all the conditions are satisfied. Does anyone have any idea how to do this?

Upvotes: 1

Views: 69

Answers (1)

michael.hor257k
michael.hor257k

Reputation: 117102

Try:

<xsl:choose>
    <xsl:when test="Cond1 and Cond2 and Cond3">A</xsl:when>
    <xsl:otherwise>B</xsl:otherwise>
</xsl:choose>

Upvotes: 4

Related Questions