Please try the following stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" /> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> <xsl:template match="*[normalize-space() = '']" /> </xsl:stylesheet> This works fine with Xalan-J 2.7.0. The 1st template is an identity template (which copies the whole source XML to the output). The second template removes specific elements from the result tree. On 9/20/06, Satrac <[EMAIL PROTECTED]> wrote:
Hi all! I have a trouble with xslt transform. I have some xml like: <message> <header> <elem1>elem1</elem1> <elem2/> </header> <body> <belem1> <subelem1>sub1</subelem1> <subelem2/> </belem1> <belem2> <subelem1/> <subelem2/> </belem2> </body> </message> I want to kill all empty nodes and transform it to document like: <message> <header> <elem1>elem1</elem1> </header> <body> <belem1> <subelem1>sub1</subelem1> </belem1> </body> </message> I have maked xsl. <?xml version="1.0" encoding="windows-1251" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:template match="*[count(.//*[text()!=''])!=0 or text()!='']"> <xsl:element name="{name()}"> <xsl:copy-of select="@*" /> <xsl:apply-templates /> </xsl:element> </xsl:template> </xsl:stylesheet> In other xslt processors its works perfect, but not in Xalan. I can't use another processor. Can somebody help me?
-- Regards, Mukul Gandhi http://gandhimukul.tripod.com