Re: [xsl] method='text' ... whitespace problems

Subject: Re: [xsl] method='text' ... whitespace problems
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 Nov 2002 11:47:09 -0500
At 2002-11-18 16:05 +0000, DPawson@xxxxxxxxxxx wrote:
I'm having fun and games generating some plain text output.

Those are two of the words for that, yes.


The indent is not giving any problems, but the newline certainly is.
...
I'm looking for an explanation of what happens with output='text',
within a template,

Nothing happens "within a template" for output="text" because the output interpretation only happens once the result tree is built.


The XML processor reading the XML instance of your stylesheet normalizes the operating system end of line sequences to be a simple &#xa; character. Hence you will never see a CR/LF pair from a MS* system.

and for suggestions as to a definition of the nl entity
which might suit either/both win32 + *nix environs.

I'm unaware of any that will do so because of rules of the XML processor.


When I parameterize my text-output exercise files for the operating system, I centralize the newline definition as follows:

<!DOCTYPE xsl:stylesheet [<!ENTITY nl "&#xd;&#xa;">]>

and then use <xsl:text>&nl;</xsl:text> in my stylesheet.

Since it is a character entity and not an operating system end of line sequence, both characters remain untouched.

I'm pretty sure there are no guidelines for implementers to note the nature of the operating system end of line sequences during the serialization of text output files. Hence I think you are out of luck for a system independent approach.

I hope this helps.

............ Ken


-- Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO: - North America: Feb 3 - Feb 7,2003

G. Ken Holman               mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.        http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                     Definitive XSLT and XPath
ISBN 0-13-140374-5                             Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1             Practical Formatting Using XSL-FO
Next conference training:                    2002-12-08,03-03,06


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



Current Thread