[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to prevent blank lines and blank inserts for t

Subject: Re: How to prevent blank lines and blank inserts for this script?
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Mon, 7 Dec 2009 15:35:54 +0000
Re:  How to prevent blank lines and blank inserts for t
Add <xsl:strip-space elements="*"/> as a top level element

cheers
andrew

2009/12/7 Ben Stover <bxstover@xxxxxxxxxxx>:
> 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>
>
>



--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.