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

[xsl] Re: A whitespace question, but probably not the same as the other ones


Subject: [xsl] Re: A whitespace question, but probably not the same as the other ones
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 6 Jun 2001 23:40:34 -0700 (PDT)

--- Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> 
> Your xml parser (most probably MSXML) is ignoring the whitespace-only nodes.
> To make it include whitespace-only nodes in the case of MSXML set:
> 
> objXMLDOMDocument.preserveWhiteSpace = true;
> 

Another possible cause is that two normalised values are concatenated, and the
ending white space of the first one and the starting whitespace of the second one
were eliminated. this can happen like in the following example:

<x>
    <a> Some text </a>
    <b> Some more text </b>
</x>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" />

    <xsl:template match="x/*">
        <xsl:value-of select="normalize-space()" />
    </xsl:template>
</xsl:stylesheet>

Result:
------
Some textSome more text


To avoid this, reproduce the starting and ending characters of a text node and
normalise the rest of it.

Or, concatenate text nodes and only then normalize-space() the concatenation.


Dimitre Novatchev.


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml