即使使用 <xsl:text>,XSL 也会忽略我的空格.标签 [英] XSL ignores my whitespace even with the <xsl:text> tag
问题描述
我正在我的 XSL 代码中创建一个包含多个信息字段的标题,即姓名:鲍勃出生日期:1900 年 1 月 1 日"等.我将它们用标签括起来,如下所示:
I'm making a header in my XSL code that includes multiple fields of information, i.e. "Name: Bob Birthdate: January 1 1900," etc. I enclosed them in tags as such:
<xsl:text> Gender: Male </xsl:text>
但是在页面上,性别/男性周围的空白被忽略了.有什么我遗漏的吗?
But on the page, the whitespace around Gender/Male is being ignored. Is there something I'm missing?
提前致谢.
推荐答案
如果你想输出一个文本文件,你应该指定一个 <xsl:output method="text"/>
作为
元素的子元素.
If you want to output a text file you should specify an <xsl:output method="text"/>
as a child of the <xsl:stylesheet>
element.
当将输出视为 HTML 时,解析器可能会打包您的空格,如果您想要带有不间断空格的 HTML 输出,则可以使用  
不间断空格实体(注意
可能不起作用,因为它不是 XML 实体,除非您自己声明).
When treating output as HTML the parser might pack your spaces, if HTML output with non-breaking spaces is what you want you can use the  
non-breaking space entity (note that
might not work since it's not an XML entity, unless you declare it yourself).
这篇关于即使使用 <xsl:text>,XSL 也会忽略我的空格.标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!