cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT <if> tag in XSLT mapping

former_member342243
Participant
0 Kudos

I want to do xslt mapping in one of my scenario. and i want to use <IF> tag in it .

My question is can i use this tag like below in xslt mapping ?

<xsl:if test="PropertyValuationList/PropertyValuation/PropertyReference[text()='/CCM/PRODUCT_ID']/../PropertyValues/SimpleValue/NameSpecification/text()!=''" OR test="PropertyValuationList/PropertyValuation/PropertyReference[text()='/CCM/SUPPLIER_PART_ID']/../PropertyValues/SimpleValue/NameSpecification/text()!=''">

..... some other process...

</xsl:if>

please help me in this.

Accepted Solutions (1)

Accepted Solutions (1)

alejandro_mejias
Active Participant
0 Kudos

Try to explain the test you are doing. This is not correct

PropertyValuationList/PropertyValuation/PropertyReference[text()='/CCM/PRODUCT_ID']

because text() is a method of PropertyReference....

Maybe if you post a sample XML file and try to explain the test you want to do I can help you.

former_member342243
Participant
0 Kudos

My question is can i use OR in <If> tag.. like

<xsl:if test="condition1" OR test="Condition2">

    <!-- Statement1 -->

</xsl:if>

   

   

or i need to do this like..    

<xsl:if test="condition1">

    <!--  Statement1 -->

</xsl:if>

<xsl:if test="condition2">

    <!--  Statement1 -->

</xsl:if>

Former Member
0 Kudos

Hello,

>>My question is can i use OR in <If> tag.. like

Yes

<xsl:if test="condition1" or test="Condition2">

    <!-- Statement1 -->

</xsl:if>

Thanks

Amit Srivastava

iaki_vila
Active Contributor
0 Kudos

Hi Rohan,

As far as i know this structure should be work:

<xsl:if test="Value1 = 'A' or Value2 = 'B'">

<!-- Do Something -->

</xsl:if>

Regards.

alejandro_mejias
Active Participant
0 Kudos

Yes, use xpath OR operator. Also you can optimize the query if you compare the same field by using contains.

<xsl:if test="field1 = 'A' or field1 = 'B'"><!-- more --></xsl:if> is equivalent to

<xsl:if test="contains('|A|B|', concat('|', field1, '|')">

Answers (0)