Re: [xsl] Preserve Whitespace with Mixed Content (Text and Tags)

Subject: Re: [xsl] Preserve Whitespace with Mixed Content (Text and Tags)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 13 May 2005 16:53:39 +0100
> I am using the XMLSpy (2004 rel. 3) built in XSLT engine, as well as
> MSXML, 

they may both use the same xml parser even if they are different xsl
engines. (I don't know)

> The problem with xsl:preserve-space seems to be 
> that it works on text-only nodes, and not on nodes with mixed content, 
> such as in my case. I have no problem retaining the spaces in text-only 
> nodes (e.g., <THD>   Blah Blah    </THD).

preserve-space would have no effect on that node as the text node is not
all white. preserve-space strip-space (and Microsof'ts non conforming
white space removal) only affect text nodes that _only_ consist of
white space.

If you are using a system that is using msxml to parse the XML and you
can't set teh whitespace property before parsing then you can put
xml:space="preserve"
in your source file (eg on the top level element) with the same result.
there is nothing you can do from XSLT as the spaces are removed by the
parser before XSLT starts.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread