问题描述
如何使用 xsl 1.0 获取文件名?
How can I get the file name using xsl 1.0?
我试过了
<xsl:value-of select="base-uri()" />
但得到致命错误!找不到函数:base-uri"
推荐答案
在 XSLT v1/XPath v1 中没有这样的 XPath 函数,或者 XSLT 对 XPath 函数的 XSLT 扩展来做到这一点.
There is no such XPath function, or XSLT extension to XPath function to do this in XSLT v1/XPath v1.
很可能没有文件,即使 XSLT 引擎没有理由拥有该文件名(考虑将文件内容加载到缓冲区中,将缓冲区解析为 DOM,然后传递DOM 到 XSLT 处理器).
It is quite possible for there to be no file, and even if there is no reason for the XSLT engine to have that file name (consider loading the file content into a buffer, parsing the buffer into a DOM and then passing the DOM to the XSLT processor).
您需要将文件名传递到处理器中才能作为转换中的参数使用.
You will need to pass the filename into the processor to be available as a parameter in the transform.
这篇关于使用 xsl 获取文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!