General discussion

Locked

How to recognize newline in XSLT?

By Paul Dineen ·
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 <xsl:when test""> expression
can match it. The code is:
<xsl:when test="contains($tail,$newLine)">
where I've used <xsl:text> 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:
<xsl:variable name="newLine"><xsl:text>
</xsl:text></xsl:variable>
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 conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

How to recognize newline in XSLT?

by andrew In reply to How to recognize newline ...

Have you tried #10 to represent the ascii character?

Collapse -

How to recognize newline in XSLT?

by Shanghai Sam In reply to How to recognize newline ...

did the trick. Thanx!

(BTW, &#x0a works too, but this one was
the first response.)

Collapse -

How to recognize newline in XSLT?

by madhusudan_p In reply to How to recognize newline ...

try
or &#xa0

Collapse -

How to recognize newline in XSLT?

by Shanghai Sam In reply to How to recognize newline ...

Poster rated this answer

Collapse -

How to recognize newline in XSLT?

by Paul Dineen In reply to How to recognize newline ...

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums