Hello All
I have one issue related to removing tag from xml file while creating it by applying xsl.
e.g:
<xsl:element name="operation">
<xsl:if test="string-length(here value of a1 from another xml) > 0">
<xsl:element name="a1">
<xsl:value-of select="normalize-space(here value of a1 from another xml); />
</xsl:element>
</xsl:if>
<xsl:if test="string-length(here value of a1 from another xml) > 0">
<xsl:element name="a1">
<xsl:value-of select="normalize-space(here value of a1 from another xml); />
</xsl:element>
</xsl:if>
<xsl:if test="string-length(here value of a1 from another xml) > 0">
<xsl:element name="a1">
<xsl:value-of select="normalize-space(here value of a1 from another xml); />
</xsl:element>
</xsl:if>
<!--END: a1-->
</xsl:element>
<!--END: operation-->
There are number of child tags such as a1,b1,c1,d1 with multiple counts[as shown in example a1] whose value is coming from another Parent XML{whose tags and names are different}. The child elements are created only when the value in another XML i.e. Parent XML is not null.
My issue is i want to remove the operation tag if its child node does not exists.
Note: In this i don't want to apply another XSL for removing the operation tag. As i created the sample application by applying another XSL on the output.xml which is working fine.
the code is use to remove the operation tag if child node does not exists is shown below used in another xsl
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="operation[not(a1or b1 or c1 or d1)]"/>
Is there any way by which i can remove the tag by applying only one XSL.
Thanks for helping in advance and waiting for your suggestion.