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>
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER