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

Re: using normalize-space with mixed element content

Subject: Re: using normalize-space with mixed element content (more info)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 09 Jun 2010 00:56:22 +0100
Re:  using normalize-space with mixed element content
On 09/06/2010 00:44, Lynn Murdock wrote:
i'm using xslt 2.0, with saxon (8.7), integrated into an IDE (intellij).

saxon 8's pretty old, any reason not to be using 9?

i also forgot to mention that normalize-space is not removing the whitespace between the italic tags, it's just stripping the italic formatting.

That doesn't sound likely, are you sure?
normalize-space requires a string as input so if you give it an element with mixed content it starts off by taking the string value of the content (so just gets the character data) it is this string value that is then normalized, so any runs of white space within a nested element should be converted to a single space (or dropped completely if they constitute either end of the entire string).

All the solutions given so far work with xslt 2 (mine also xslt 1)
which you want depends on which you want, specifically whether you need runs of space to be converted to a single #20 character (as normalize-space would do, (only mine did that) whether you want space stripped if it occurs at the end but in a child element (only Gerrit's did that) or whether you wanted it to be succinct and understandable (Michael's version)


Current Thread


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.
First Name
Last Name
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.