How to recognize newline in XSLT? - TechRepublic
General discussion
August 3, 2001 at 11:44 AM
paul dineen

How to recognize newline in XSLT?

by paul dineen . Updated 24 years, 10 months ago

I’m having a devil of a time trying to get
my XSLT script to replace all occurrences
of the newline character with a newline
followed by a tab. The problem is, I can’t
figure out how to express the newline
character so the expression
can match it. The code is:

where I’ve used to set $newLine
to a variety of values, but none have worked.
I’ve tried \n, \\n, and probably others
I’ve forgotten. Another I’vetried is:


None of these has matched the newline in
the string contained in $tail.
I’ve checked using the Unix od(1) command
and found that the numeric value of the
character I’m tring to match is decimal 10
(shows as 0a in the “od -xc” output).

I’m tempted now to try to use an xsl
extension to JavaScript to try to do the
algorithm there, but I’d really rather
stick with just xsl.

Thanks.

This discussion is locked

All Comments