RE: [xsl] <xsl:strip-space> does NOT work when comment lines are involved (directly before).

Subject: RE: [xsl] <xsl:strip-space> does NOT work when comment lines are involved (directly before).
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 8 Dec 2009 10:28:16 -0000
> But I want to remove 
> only these blank lines which are created when empty elements 
> are removed (with the templates of the remaining script). 

First try to understand what is happening. The blank lines are being copied
from your input because you are applying teh built-in template rule for text
nodes, which copies them unchanged. If you want to copy some whitespace text
nodes from the input but not others, then you are going to have to write
template rules that control this behaviour. As David says, if you really
want this degree of control over whitespace, then don't use strip-space to
remove it from the input, and don't use indent="yes" to add it to the
output; instead you will need to write template rules that very carefully
process different whitespace text nodes in different ways.

Are you really sure this is a requirement?

By the way:

<xsl:template match="*[normalize-space( concat(.,@*) )='']"/>

That's a very odd pattern. concat(., @*) concatenates the string value of
the element with the string value of its first attribute, chosen at random
(because attribute order is unpredictable). A better test might be



Michael Kay 

Current Thread