user3247872
user3247872

Reputation: 27

putting the xsl condition in a better way

Please advise is there any better way to express this below xsl condition or this below one is correct.. we are using xslt 1.0

<xsl:if test="$abcPeriod_first=gfd_Rate">
    <xsl:value-of select="'AAA'" />
</xsl:if>
    <xsl:value-of select="'BBB'" />

Upvotes: 0

Views: 28

Answers (1)

Floris
Floris

Reputation: 46435

If you want an if...else then I believe your current condition is not sufficient. You could use the following:

<xsl:choose>
  <xsl:when test="$abcPeriod_first=gfd_Rate">
    <xsl:value-of select="'AAA'" />
  </xsl:when>
  <xsl:otherwise>
    <xsl:value-of select="'BBB'" />
  </xsl:otherwise>
</xsl:choose>

Upvotes: 1

Related Questions