xsl-list
[Top] [All Lists]

Re: [xsl] using normalize-space with mixed element content (more info)

2010-06-08 18:56:43
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)


David

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