I have a XML like:
<all>
<one>Something 1</one>
<two>something 2</two>
<check>
<present>true</present>
</check>
<action>
<perform></perform>
</action>
</all>
I want to perform XML Transformation using XSL:
expected output:
if <present>true</present>
all>
<one>Something 1</one>
<two>something 2</two>
<check>
<present>YES</present>
</check>
<action>
<perform>READ</perform>
</action>
</all>
else if : <present>false</present>
<all>
<one>Something 1</one>
<two>something 2</two>
<check>
<present>NO</present>
</check>
<action>
<perform>INSERT</perform>
</action>
</all>
Is it possible to Do? I am not aware about condition checking in XSL I try to move the element but did not worked:
<xsl:template match="perform">
<xsl:copy>
<xsl:choose>
<xsl:when test="../check/present = 'true'">
<xsl:text>READ</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>