包含带有XSLT 1.0的纯文本文件
如何在XSLT 1.0样式表中的结果文档中包含纯文本文件的内容?即,就像 document()
,但没有解析它:
How can I include the content of a plain text file in a result document from within an XSLT 1.0 stylesheet? I.e., just like document()
, but without parsing it:
<xsl:value-of select="magic-method-to-include-plaintext(@xlink_href)" />
我几乎确定,如果没有扩展,这不起作用,因为:
I am almost sure, that this doesn't work without extension, because:
-
在XSLT / XPath 2.0中为此定义了一个特殊的XPath函数:
there is a special XPath function defined for this in XSLT/XPath 2.0:
<xsl:value-of select="unparsed-text(@xlink:href, 'UTF-8')"/>
XSLT FAQ仅列出 Java扩展通过EXSLT实现这一目标
the XSLT FAQ only lists a Java extension to achieve this via EXSLT
然而,也许我错过了什么?
However, perhaps I missed something?
但是,也许我错过了什么?
However, perhaps I missed something?
不,XSLT 1.0无法在不使用的情况下访问非xml文本文件的内容扩展函数。
解决此问题的一种方法是将字符串作为全局参数传递给转换。
One way around this is to pass the string as a global parameter to the transformation.