I want to check if the node <Type>
is either "Debit" or "Credit"
so that I can transform the information from just credit card information into Debit or Credit transactions.
any suggestion????
I want to check if the node <Type>
is either "Debit" or "Credit"
so that I can transform the information from just credit card information into Debit or Credit transactions.
any suggestion????
The element xsl:if
is for "if A do B else do nothing". Use xsl:choose
(with xsl:when
and xsl:otherwise
) for "if A do B else do C". Otherwise we do need a more specific example of what you mean.
I particularly like using xsl:choose in most situations. It provides the most flexibility. I also would use a variable outside the template for type.
Variable code (belongs outside templates):
<xsl:variable name="$type">
<xsl:value-of select="//type" />
</xsl:variable>
xsl:choose code (belongs in a template):
<xsl:choose>
<xsl:when test="$type='credit'">
<xsl:text>Type is credit card</xsl:text>
</xsl:when>
<xsl:when text="$type='debit'">
<xsl:text>Type is debit card</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Type is neither debit or credit card</xsl:text>
</xsl:otherwise>
</xsl:choose>
Hope this helped :)