xsl-list
[Top] [All Lists]

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

2009-12-08 05:28:46
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

match="*[not((.|@*)[normalize-space()])]"



Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



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