cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT code - If Condition

Former Member
0 Kudos

Hello,

Can someone help me to give an XSLT code for the following condition?

Source Message:

/Order/Ident/ReceiverID = 203

Condition:

If the value of Source ReceiverID is 203, then, make it to the value to 456.

I've tried this code, but seems to be many error validations.

<xsl:template match="/Order/Ident/ReceiverID">

<xsl:choose>

<xsl:when test="203">

<xsl:attribute name="203">

<xsl:value-of select="456"/>

</xsl:attribute>

</xsl:when>

<xsl:otherwise>

<xsl:attribute name="203">unknown</xsl:attribute>

</xsl:otherwise>

</xsl:choose>

</xsl:template>

Should you have helpful links, please let me know. I will greatly appreciate it.

Thanks in advance!

Gerberto

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks very much!

The code is ok now!

Many thanks.

Former Member
0 Kudos

Gerberto,

Try this -



<xsl:choose>
	<xsl:when test="*[local-name()='ReceiverID']='203' ">
		<ns:YourField>
			<xsl:value-of select="456"/>
		</ns:YourField>
	</xsl:when>
	<xsl:otherwise>
		<ns:YourField>
			<xsl:value-of select="203"/>
		</ns:YourField>
	</xsl:otherwise>
</xsl:choose>

Let me know if this works for you.

Regards,

Neetesh