exslt.org 扩展

发布于 2024-08-19 09:41:14 字数 1255 浏览 1 评论 0原文

我正在尝试在我的一项转换中使用 exslt 扩展。我从这个网站得到了一个关于如何将 xml 文件连接成一个的示例。

我已经正确实现了命名空间和元素前缀,但是每次尝试从命令行运行它时,我都会收到以下错误...

找不到名为 {http://exslt.org/common}变量step-concat中的node-set()(文件名和行号在这里等等)

我不知道出了什么问题,因为我对这些东西很陌生。我的 xsl 文件是

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl">

<!-- STEP Files -->
<xsl:variable name="step-output">
    <xsl:for-each select="/index/file">
        <xsl:copy-of select="document(.)" />
    </xsl:for-each>
</xsl:variable>

<!-- STEP Files as one -->
<xsl:variable name="step-concat" select="exsl:node-set($step-output)" />

<!-- Root Template -->
<xsl:template match="/">
    <xsl:element name="foo">
        <xsl:apply-templates select="$step-concat/foo"/>
    </xsl:element>
</xsl:template>

<xsl:template match="foo">
    <xsl:element name="text">
        <xsl:value-of select="bar"/>
    </xsl:element>
</xsl:template>

我做错了什么?我尝试从 exslt.org 下载该模块,但它对我来说根本没有任何意义......

I am trying to use an exslt extension in one of my transformations. I got an example off this site about how to concatenate xml files into one.

I have implemented the namespace and the element prefix correctly, but every time I try and run it from my command line I recieve the following error...

Cannot find a matching 1-argument function named {http://exslt.org/common}node-set() in variable step-concat (filename and line number are in here blah blah blah)

I have no idea what is going wrong as I am quite new to this stuff. My xsl file is

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl">

<!-- STEP Files -->
<xsl:variable name="step-output">
    <xsl:for-each select="/index/file">
        <xsl:copy-of select="document(.)" />
    </xsl:for-each>
</xsl:variable>

<!-- STEP Files as one -->
<xsl:variable name="step-concat" select="exsl:node-set($step-output)" />

<!-- Root Template -->
<xsl:template match="/">
    <xsl:element name="foo">
        <xsl:apply-templates select="$step-concat/foo"/>
    </xsl:element>
</xsl:template>

<xsl:template match="foo">
    <xsl:element name="text">
        <xsl:value-of select="bar"/>
    </xsl:element>
</xsl:template>

What am I doing wrong? I have tried downloading the module from exslt.org, but it doesn't make any sense to me at all...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

柠北森屋 2024-08-26 09:41:14

与 Saxon PE 不同,Saxon HE 不提供任何内置扩展功能。

但是,您可以在处理器上编写并注册自己的扩展函数,这样您就可以轻松实现exsl:node-set
http://www.saxonica.com/documentation/extensibility/integratedfunctions/

另一个另一种方法是使用 Saxon B 9.1

Saxon HE does not provide any built-in extension function, unlike Saxon PE.

However, you can write and register your own extension functions at the Processor, so you could easily implement exsl:node-set:
http://www.saxonica.com/documentation/extensibility/integratedfunctions/

Another alternative is to use Saxon B 9.1

雪落纷纷 2024-08-26 09:41:14

这是一个 XSLT 1.0 样式表。 XSLT 2.0 使得许多 EXSLT 扩展函数变得不必要,例如“exsl:node-set()”。您可以将其转换为 XSLT 2.0 样式表,通过将第一行中的“版本”更改为 2.0 来执行相同的操作,并将“exsl:node-set($step-output)”替换为“$step-output” 。当然,XSLT 2.0 需要 Saxon。

That's an XSLT 1.0 stylesheet. XSLT 2.0 makes many of the EXSLT extension functions unnecessary, such as "exsl:node-set()". You could convert this to an XSLT 2.0 stylesheet that does the same thing by changing the "version" in the first line to 2.0, and replace "exsl:node-set($step-output)" with just "$step-output". Of course XSLT 2.0 would require Saxon.

烙印 2024-08-26 09:41:14

exslt.org 的内容仅在您将扩展注册/添加到 XSLT 引擎时才起作用。由于你没有提及任何有关你的平台的信息,所以很难帮助你。

The exslt.org stuff only works when you register/add the extensions to your XSLT engine. Since you don't mention anything about your platform, it's kind of hard to help you out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文