Subject: Re: [xsl] [XSLT 1.0] Q: recursively eliminate empty nodes From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 08 Nov 2010 14:28:32 -0500 |
on the input file x.xml I posted your solutions produce the same output.
As Ken asked for more inputs I tried adding a comment and then the output of your solutions and the recursive solution differ:
$ cat d.xml <a><b>c<c/></b><b><c/><!--test--></b></a> $ $ xsltproc d1.xsl d.xml <?xml version="1.0" encoding="UTF-8"?> <a><b>c</b></a> $ $ xsltproc d2.xsl d.xml <?xml version="1.0" encoding="UTF-8"?> <a><b>c</b></a> $ $ xsltproc y.xsl d.xml <?xml version="1.0"?> <a><b>c</b><b><!--test--></b></a> $
I have to ask the originator of the problem for the exact requirements.
<xsl:template match="*[not(.//text() | .//comment() | .//processing-instruction())]"/>
<xsl:template match="@*|node()"><!--identity for all other nodes--> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
</xsl:stylesheet> ~/t/ftemp $
-- Contact us for world-wide XML consulting & instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] [XSLT 1.0] Q: recursively, Hermann Stamm-Wilbra | Thread | Re: [xsl] [XSLT 1.0] Q: recursively, Hermann Stamm-Wilbra |
Re: [xsl] [XSLT 1.0] Q: recursively, Hermann Stamm-Wilbra | Date | Re: [xsl] [XSLT 1.0] Q: recursively, Hermann Stamm-Wilbra |
Month |