在 XSLT 中使用 HTML 实体(例如  ) [英] Using an HTML entity in XSLT (e.g.  )

查看:44
本文介绍了在 XSLT 中使用 HTML 实体(例如  )的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 XSLT 中包含 html 实体的最佳方法是什么?

What is the best way to include an html entity in XSLT?

<xsl:template match="/a/node">
    <xsl:value-of select="."/>
    <xsl:text>&nbsp;</xsl:text>
</xsl:template>

这个返回一个XsltParseError

推荐答案

可以使用 CDATA 部分

You can use CDATA section

<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>

或者您可以在本地 DTD 中描述 &nbsp:

or you can describe &nbsp in local DTD:

<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>

或者只是使用 &#160; 而不是 &nbsp;

or just use &#160; instead of &nbsp;

这篇关于在 XSLT 中使用 HTML 实体(例如 &amp;nbsp;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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