实体“nbsp”被引用,但未被声明 [英] The entity "nbsp" was referenced, but not declared

查看:2571
本文介绍了实体“nbsp”被引用,但未被声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个XSLT将xml转换为xml。

输入XML:

 < test>西班牙语中的Spain是Espa& nbsp; aDagon his Name,Sea Monster< / test> 

OutputXML:

 < test>西班牙语中的Spain是Espa aDagon他的名字,海怪< / test> 

XSL FILE:我添加了doctype下实体nbsp声明的代码并替换为实体,但仍然

 < xsl:template match =test>相同的错误实体nbsp被引用,但未被声明。 ; 
< test>
< xsl:apply-templates />
< / test>


解决方案

您需要让输入声明它使用的实体,如 http://xsltransform.net/gVhD8QR 与例如

 <!DOCTYPE test [
<!ENTITY nbsp&#160;>>
]>
< test>西班牙语中的Spain是Espa& nbsp; aDagon他的名字,海怪< / test>

请注意,西班牙语中的西班牙一词是España,因此在那里使用的示例实体在那里没有任何意义。


I have written one XSLT to transform xml to xml.

Input XML:

<test>The Spanish word for "Spain" is "Espa&nbsp;a" Dagon his Name, Sea Monster</test>

OutputXML:

<test>The Spanish word for "Spain" is "Espa a" Dagon his Name, Sea Monster</test>

XSL FILE: i have added the code for entity nbsp declaration under doctype at and replace with   entity but still are same error The entity "nbsp" was referenced, but not declared.

<xsl:template match="test">
<test>
  <xsl:apply-templates/>
</test>

解决方案

You need to have the input declare the entities it uses, as done in http://xsltransform.net/gVhD8QR with e.g.

<!DOCTYPE test [
  <!ENTITY nbsp "&#160;">
]>
<test>The Spanish word for "Spain" is "Espa&nbsp;a" Dagon his Name, Sea Monster</test>

Note that the Spanish word for "Spain" is "España" however, so the example entity used there does not make sense there anyway.

这篇关于实体“nbsp”被引用,但未被声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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