开发者

Issue with XSLT line-break

开发者 https://www.devze.com 2023-01-29 13:03 出处:网络
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 G开发者_如何学Cuys Doing?!?</message>

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 G开发者_如何学Cuys 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>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号