如何使用包装在另一个XML中的CDATA中的XML进行XSL转换? [英] How to use XML wrapped in CDATA inside another XML for XSL transformation?
问题描述
XML文档包含另一个XML元素,该元素包装在CDATA中。
An XML document contains another XML element, which is wrapped in CDATA.
包装后的XML如何用于XSL和XSL-FO转换(版本1) ?
How can the wrapped XML be used for XSL and XSL-FO transformation (version 1)?
推荐答案
在单个转换中,标准XSLT 1.0或2.0无法做到这一点。
This is not possible with standard XSLT 1.0 or 2.0, in a single transformation.
可以使用Saxon 9 Professional Edition或Enterprise Edition完成此操作。这些产品具有 saxon:parse()
扩展功能。或使用 XPath 3.0 parse-xml()
函数,最近也支持Saxon PE / EE版本。
It can be done using Saxon 9 Professional Edition or Enterprise Edition. These products have a saxon:parse()
extension function. Or use the XPath 3.0 parse-xml()
function, which is also supported by recent versions of Saxon PE/EE.
正如@grtjn所指出的,可以通过两次通过处理。样式表1将CDATA包装的文本转换为可解析的XML(使用< xsl:value-of select = whatever disable-output-escaping = yes />
)。然后,样式表2处理样式表1产生的序列化结果。
As @grtjn points out, it is possible to do it with a two-pass process. Stylesheet 1 turns the CDATA-wrapped text into parseable XML (using <xsl:value-of select="whatever" disable-output-escaping="yes"/>
). Stylesheet 2 then processes the serialized result produced by stylesheet 1.
这篇关于如何使用包装在另一个XML中的CDATA中的XML进行XSL转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!