Leonardo
Leonardo

Reputation: 11401

Issue with XSLT line-break

I'm having a problem. How can I instruct my XSLT to insert a new line?

Here's an example of my XML:

<message>Hello World!!! \r\n How You Guys Doing?!?</message>

or:

<message>Hello World!!! <br /> How You Guys Doing?!?</message>

and here's the XSL:

<html><body><xsl:valeof select="message"/></body></html>

Upvotes: 1

Views: 1316

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167716

Assuming the input

<message>Hello World!!! <br /> How You Guys Doing?!?</message>

it should suffice to use

<xsl:copy-of select="message/node()"/>

in your XSLT. Replacing \r\n is more difficult, at least in XSLT 1.0. See http://www.dpawson.co.uk/xsl/sect2/N7240.html#d10122e406 for a possible approach.

Upvotes: 2

Related Questions