Link to home
Start Free TrialLog in
Avatar of sri1209
sri1209

asked on

replace tag of the xml by reading on of the tag value

Hi ,

i am trying to change one of the xml tags <MA> to <MAP> by reading the value of some other tag in the same parent node, here i am reading "Approval/HA " value and change the tag , but its only working if  Approval/HA ='D' is true , its not working for other conditions. can somebody let me know if the "or" condition should be the way as below or is different.

Thanks for the help.

<xsl:template match="Details/MA">
 <xsl:variable name="ename">
 <xsl:text>MA</xsl:text>
<xsl:if test="Approval/HA ='D' or Approval/HA= 'T' or  Approval/HA= 'C'">
  <xsl:text>P</xsl:text>
</xsl:if>
</xsl:variable>
 <xsl:element name="{$ename}"> <xsl:copy-of select="@*"/>
 <xsl:apply-templates select="node()"/>
 </xsl:element>
 </xsl:template>
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sri1209
sri1209

ASKER

Thanks Geert, i realized i was testing the wrong way, thanks for your help. as always it works.