This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: A whitespace question, but probably not the same as the other ones


Ok, good call.  I had forgotten I set:
        parser.setFeature(
"http://apache.org/xml/features/dom/include-ignorable-whitespace";,
                               false );  
to fix another problem.  Now I need to figure out how to fix those other
problems.  But the ones I've tried so far I seem to be able to control with
normalize-space().  I tried so many different things, I lost track of what I
tried.  I guess if the whitespace wasn't there in the first place, nothing I
did in the stylesheet would matter.

Kerry.

-----Original Message-----
From: Dimitre Novatchev [mailto:dnovatchev@yahoo.com]
Sent: Thursday, June 07, 2001 12:41 AM
To: Kerry.Nice@LexisNexis.com
Cc: xsl-list@lists.mulberrytech.com
Subject: Re: A whitespace question, but probably not the same as the
other ones


--- Dimitre Novatchev <dnovatchev@yahoo.com> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]