I have to recreate a new xml with different tag names and values from the 'old' xml using xslt 1.0.
My problem is that it generates empty tags even when the value is not there to put in between the tags.
Is there a way of getting rid of those empty tags at the end of the transformation?
I know you could do the for-each loops and do something like that, but the problem with this is that I would need to do multiple transformations which is not desirable:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match=
"*[not(node())]
|
*[not(node()[2])
and
node()/self::text()
and
not(normalize-space())
]
"/>
</xsl:stylesheet>
No comments:
Post a Comment