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

RE: <xsl:strip-space> does NOT work when comment lines

Subject: RE: <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
RE:  <xsl:strip-space> does NOT work when comment lines
> 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 

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.