xslt中的新行正在为我创建一个问题。我搜索了很多,发现了很多在xslt中插入新行字符的方法。但没有任何结果。我试过用
<xsl:text></xsl:text>, <xsl:text>
</xsl:text>
和许多其他新行字符。但失败了。我不想使用任何html字符,如<br/>
n all。我只想知道如何获得new line in xslt
。Does it depend on the os used, processor, xslt version or anything?
输出我想要的是:
Dear abc,
You Have received a Mail.
但我得到的是:
Dear abc, You have received a mail.
我甚至用过
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:text>
 1 
 2 
 </xsl:text>
</xsl:template>
</xsl:stylesheet>
但仍然在一行中显示1 2。
答案 0 :(得分:0)
根据评论部分中的回复,您的问题的原因似乎只是您创建了一个“.html”结果文件,然后在浏览器中查看该文件,该浏览器应用HTML显示规则,其中新行通常只是折叠到空间。 因此问题的解决方案是简单地确保您创建一个“.txt”文件,这样就可以在查看文件时显示新行。