This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Detecting a linefeed in input text, how?
- To: "Steve Carton" <scarton at retrievalsystems dot com>
- Subject: Re: Detecting a linefeed in input text, how?
- From: Jeni Tennison <jeni at friday dot u-net dot com>
- Date: Wed, 09 Aug 2000 19:35:41 +0100
- Cc: XSL-List at mulberrytech dot com
- Reply-To: xsl-list at mulberrytech dot com
Steve,
>I'm processing a node that has embedded line feed characters. I'm
>trying to output the original lines, but with spaces added to the front.
>I wrote the following template, but it doesn't detect the line feeds:
[snip]
>Any ideas?
A couple.
First is that '#0A' is, in XML, literally the string '#0A'. To get a
linefeed character, try using the character entity reference '
' instead.
The other thing that immediately springs to mind is to make sure that
whitespace is being preserved in the 'indenter' element within your XML
source. If it isn't, then any line feeds are going to be interpreted as
spaces. To prevent this happening, set xml:space="preserve" on that
element (or in the DTD).
Your template scans OK otherwise.
I hope that helps,
Jeni
Dr Jeni Tennison
Epistemics Ltd * Strelley Hall * Nottingham * NG8 6PE
tel: 0115 906 1301 * fax: 0115 906 1304 * email: jeni.tennison@epistemics.co.uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list