即使使用 <xsl:text>,XSL 也会忽略我的空格.标签 [英] XSL ignores my whitespace even with the <xsl:text> tag

查看:30
本文介绍了即使使用 <xsl:text>,XSL 也会忽略我的空格.标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的 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 输出,则可以使用 &#160; 不间断空格实体(注意&nbsp; 可能不起作用,因为它不是 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 &#160; non-breaking space entity (note that &nbsp; might not work since it's not an XML entity, unless you declare it yourself).

这篇关于即使使用 &lt;xsl:text&gt;,XSL 也会忽略我的空格.标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆