I am transforming one XML into another form of XML using XSL.
我正在使用XSL将一个XML转换为另一种形式的XML。
While transforming, the non-english characters are escaped. say 'Ã' is escaped as "Atilde;".
在转换过程中,将转义非英语字符。说“A”被转义为“Atilde;”
While parsing the transformed xml, I am seeing the following error :
在解析转换后的xml时,我看到了以下错误:
org.xml.sax.SAXParseException: The entity "Atilde" was referenced, but not declared.
org.xml.sax。SAXParseException:引用了实体“Atilde”,但没有声明。
My requirement is, I don't want to allow the non-english characters to be escaped. I want to retain the characters as they are.
我的要求是,我不想让非英语字符被转义。我想保留这些人物本来的样子。
In the XSL that I am using to transform the XML, I have coded the below statement :
在我用来转换XML的XSL中,我编写了以下语句:
<xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="no"/>
should I change any of these attributes to achieve my requirement
我是否应该更改这些属性以满足我的需求
2 个解决方案
#1
4
you need to provide a doctype
您需要提供一个doctype
<xsl:output method="xml" indent="yes" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" omit-xml-declaration="no"/>
#2
1
You cannot handle this in the <output>
tag, but you can chose not to escape output when you generate text
elements in the transform. To do this use:
您不能在
<xsl:text disable-output-escaping="yes">
#1
4
you need to provide a doctype
您需要提供一个doctype
<xsl:output method="xml" indent="yes" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" omit-xml-declaration="no"/>
#2
1
You cannot handle this in the <output>
tag, but you can chose not to escape output when you generate text
elements in the transform. To do this use:
您不能在
<xsl:text disable-output-escaping="yes">