dimanche 29 décembre 2019

Using if-else statement in XSLT for-each

I have a xslt document. And i want use if statement in this document. My code is:

<xsl:for-each select="cbc:ProfileID"> 
    <xsl:apply-templates/>

    <xsl:if test="cbc:ProfileID='code1'">
        <xsl:text>A</xsl:text>
    </xsl:if>
    <xsl:if test="cbc:ProfileID='code2'">
        <xsl:text>B</xsl:text>
    </xsl:if>

</xsl:for-each>

I want if returned value is code1 then write A and if returned value is code2 then write B.

How can i do this?

Aucun commentaire:

Enregistrer un commentaire