Hi,
I have an XML document from which I have to exclude records with all their child elements empty.
So the resulting XML Document have to look like this:
After whole day of banging with it I came up with the following XSLT:
I have an XML document from which I have to exclude records with all their child elements empty.
<Employees><Employee><FirstName>Sam</FirstName></Employee><Employee><FirstName></FirstName></Employee></Employees>
So the resulting XML Document have to look like this:
<Employees><Employee><FirstName>Sam</FirstName></Employee></Employees>
After whole day of banging with it I came up with the following XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="@*|node()"><xsl:if test=". != ''"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:if></xsl:template></xsl:stylesheet>which still gives me not what I want - here is what I am getting, note that empty <Employee/> record:
<Employees><Employee><FirstName>Sam</FirstName></Employee><Employee/></Employees>Somebody, please, how do I modify the XSLT to get rid of whole Employee record, not only its empty elements? Thank you very much!