xsl-list
[Top] [All Lists]

Re: [xsl] Remove adjacent whitespace when removing element

2013-11-15 06:47:25
It looks like your input has no mixed content, in which case it makes sense to 
use

<xsl:strip-space elements="*"/>

to remove all interstitial whitespace on input, and

<xsl:output indent="yes"/>

to reconstruct it on output.

Michael Kay
Saxonica

On 15 Nov 2013, at 02:48, Karl Stubsjoen <kstubs(_at_)gmail(_dot_)com> wrote:

I'm writing a little simple XSLT that translates one Xml to another
and I am cherry picking items from the first Xml for the new Xml and
doing an assortment of other things as well.  All is fine and dandy,
but I'd like to trap the whitespace along with the elements that I am
removing, instead I am getting big gaps in my resulting Xml.  I
reallize that I can turn off indent, but what would be the way to
remove the related whitespace of an element that has been removed?  So
given:

<data>
<a>this is a</a>
<b>this is b</b>
<c>this is c</c>
</data>

If I trap b <xsl:template match="b"/> and do nothing with it my result
looks like:

<data>
<a>this is a</a>

<c>this is c</c>
</data>

Thanks.

Karl..

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--


<Prev in Thread] Current Thread [Next in Thread>