[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] normalize-space() except ...

Subject: Re: [xsl] normalize-space() except ...
From: "Liam R E Quin liam@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Feb 2015 00:23:41 -0000

On Mon, 9 Feb 2015 20:21:50 -0000
"dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> <dd><p>
>          This is my text
> with <i>italics content</i> with other text.
> </p></dd>
> My output is coming out like this:
> <ss:Data>This is my text with<ss:font italics="yes">italics
> content</ss:font>.</ss:Data>

I'd probably do this in two steps -
(1) match text() and turn one or more whitespace characters into a space,
    probably using replace()
(2) strip leading space from the first text() in p, and trailing space from the last;

    watch for
    <p>The man wore<i> black </i>socks</p>
    which is not unlikely in XML made from word processing software.

Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/

Current Thread