I have this XML file, I need to remove ContentText element with the attribute languageCode="FR", if the ContentText element with the attribute languageCode="EN" exist else keep the French text.
Current XML :
<MaterialByElementsResponse_sync>
<Material>
<Detail>
<ContentText languageCode="FR">Inscription</ContentText>
<ContentText languageCode="EN">Subscription</ContentText>
</Detail>
</Material>
</MaterialByElementsResponse_sync>
Desired Output :
<MaterialByElementsResponse_sync>
<Material>
<Detail>
<ContentText languageCode="EN">Subscription</ContentText>
</Detail>
</Material>
</MaterialByElementsResponse_sync>
I tried this XSLT but it is always deleting the FR text even if the EN text doesn't exist :
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="ContentText[@languageCode='FR']"/>
</xsl:stylesheet>
Remember if there is no English text, the French text shouldn't be removed.
Thank you very much.