views:

26

answers:

2

Hi,

I'm creating some xslt's using Umbraco 4.5.2 and I want to add de set:distinct function from EXSLT.org (http://www.exslt.org/set/functions/distinct/index.html) however, when I reference the set:distinct I get the error:

System.Xml.Xsl.XslTransformException: Cannot find a script or an extension object associated with namespace 'http://exslt.org/sets'.

I've added the files, the extension in xslt and the namespace like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet 
    version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:msxml="urn:schemas-microsoft-com:xslt" 
    xmlns:exsl="http://exslt.org/functions"
    xmlns:set="http://exslt.org/sets" 
    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 
    exclude-result-prefixes="exsl msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:import href="set.xsl" />

Is it me that's missing something or is it Umbraco that's throwing the error or does some underlaying network error occur somewhere (and if so, how do I find out)?

TIA!

+2  A: 

EXSLT is not implemented natively by the two .NET XSLT processors: XslCompiledTransform and (obsolete) XslTransform.

There are 3rd party implementations of EXSLT for .NET such that the one in the MVPXML project. You need to get it from here and install it on the system that performs the XSLT transformation.

You can also always use the pure XSLT 1.0 Muenchian method for grouping (there are many, many questions in the xslt tag with answers that demonstrate the Muenchian grouping) and this is preferrable in case your xslt code should be portable in order to run with as many as possible compliant XSLT 1.0 processors.

Dimitre Novatchev
+1 For point the XSLT standar solution: Muechian method.
Alejandro
A: 

The Umbraco framework already includes the Exslt.Sets implementation, so you don't need to add a further reference to it as above. You can see the reference to the Umbraco implementation in your code above, it looks like this:

xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"

Remove the lines:

xmlns:exsl="http://exslt.org/functions"
xmlns:set="http://exslt.org/sets" 

and use Exslt.ExsltSets:distinct().

Chris A
Thanks; the extensions where indeed already there!
riffnl