Add <xsl:strip-space elements="*"/> as a top level element
cheers
andrew
2009/12/7 Ben Stover <bxstover(_at_)yahoo(_dot_)co(_dot_)uk>:
When I apply the XSLT script at the bottom of this posting then it works fine
in general. The purpose is to remove empty elements and empty attributes.
But I guess this purpose is not important.
However there is one problem. The result XML doc contains a blank line at the
location of the removed element and the following element is shifted some
blanks
to the left border. Simplified example for the input.xml:
...
(3 blanks)<ns1:myelem>
(6 blanks)<ns2:aaa>123</ns2:aaa>
(6 blanks)<ns2:bbb></ns2:bbb>
(6 blanks)<ns2:ccc>456</ns2:ccc>
(3 blanks)</ns1:myelem>
...
I am getting an output.xml similar to:
...
(3 blanks)<ns1:myelem>
(6 blanks)<ns2:aaa>123</ns2:aaa>
(3 blanks)
(2 blanks)<ns2:ccc>456</ns2:ccc>
(3 blanks)</ns1:myelem>
...
How do I get rid of the blank line?
How do I get rid of the left shift of element <ns2:ccc>
Ben
XSLT script:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[normalize-space( concat(.,@*) )='']"/>
</xsl:stylesheet>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--