Including a plain text file with XSLT 1.0

余生颓废 提交于 2019-12-23 14:57:37

问题


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:

  1. there is a special XPath function defined for this in XSLT/XPath 2.0:

    <xsl:value-of select="unparsed-text(@xlink:href, 'UTF-8')"/>
    
  2. the XSLT FAQ only lists a Java extension to achieve this via EXSLT

However, perhaps I missed something?


回答1:


However, perhaps I missed something?

No, XSLT 1.0 cannot access the content of a non-xml text file without using an extension function.

One way around this is to pass the string as a global parameter to the transformation.



来源:https://stackoverflow.com/questions/2714059/including-a-plain-text-file-with-xslt-1-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!