designermonkey
designermonkey

Reputation: 1118

exslt.org extensions

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...

Upvotes: 1

Views: 3439

Answers (3)

Max Toro
Max Toro

Reputation: 28618

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

Upvotes: 3

pdxleif
pdxleif

Reputation: 1800

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.

Upvotes: 2

Lucero
Lucero

Reputation: 60276

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.

Upvotes: 0

Related Questions