在xslt中没有换行

问题描述

| xslt中的换行符对我造成了问题。我进行了很多搜索,发现了许多在xslt中插入换行符的方法。但没有结果。我尝试使用
<xsl:text></xsl:text>,<xsl:text>&#xa;</xsl:text>
和许多其他这样的换行符。但失败了。我不想使用所有像
<br/>
这样的html字符。我只想知道我将如何获得
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>&#xA; 1 &#xA; 2 &#xA; </xsl:text>

  </xsl:template>
</xsl:stylesheet>
但仍然在一行中显示1 2。     

解决方法

根据评论部分的响应,问题的原因似乎很简单,您创建了\“。html \”结果文件,然后在应用HTML显示规则的浏览器中查看了该结果文件,通常将新行折叠为空格。 因此,解决该问题的方法是仅确保您创建一个\“。txt \”文件,这样,在查看文件时将显示新行。