RE: [xsl] saxon to .net exslt problem

Subject: RE: [xsl] saxon to .net exslt problem
From: "Houghton,Andrew" <houghtoa@xxxxxxxx>
Date: Mon, 5 Nov 2007 12:53:41 -0500
> From: Don Smith [mailto:dsmith_lockesmith@xxxxxxxxx]
> Sent: 05 November, 2007 12:08
> To: XSLT
> Subject: [xsl] saxon to .net exslt problem
> I've developed an 1.0 transformation using the Saxon Java
> engine. It uses the date() function from the exslt library.
> Everything works fine.
> We're now trying to move this to a .NET 2.0 environment.
> This code snippet:
> System.Xml.Xsl.XslCompiledTransform xsl = new
> System.Xml.Xsl.XslCompiledTransform();
> xsl.Load(xsltPath);
> xsl.Transform(xmlPath, htmlPath); // THIS LINE THROWS AN ERROR
> throws this error:
> System.Xml.Xsl.XslTransformException: Cannot find the script
> or external object that implements prefix
> ''. at. . .(I can include the
> rest of this error message if necessary)

You probably need to register the extension functions.  The
following code is based on EXSLT.NET (a defunct
project), not Saxon, but the solution is probably similar:

Dim urlResolver As New XmlUrlResolver
Dim xmlDocument As New XmlDocument
Dim xslDocument As New XslTransform
Dim params      As New XsltArgumentList

xslDocument.Load(xmlDocument, urlResolver,

params.AddExtensionObject(ExsltNamespaces.Common, New ExsltCommon)
params.AddExtensionObject(ExsltNamespaces.DatesAndTimes, New
params.AddExtensionObject(ExsltNamespaces.Math, New ExsltMath)
params.AddExtensionObject(ExsltNamespaces.Random, New ExsltRandom)
params.AddExtensionObject(ExsltNamespaces.RegularExpressions, New
params.AddExtensionObject(ExsltNamespaces.Sets, New ExsltSets)
params.AddExtensionObject(ExsltNamespaces.Strings, New ExsltStrings)
params.AddExtensionObject(ExsltNamespaces.GDNDatesAndTimes, New
params.AddExtensionObject(ExsltNamespaces.GDNDynamic, New GDNDynamic)
params.AddExtensionObject(ExsltNamespaces.GDNMath, New GDNMath)
params.AddExtensionObject(ExsltNamespaces.GDNRegularExpressions, New
params.AddExtensionObject(ExsltNamespaces.GDNSets, New GDNSets)
params.AddExtensionObject(ExsltNamespaces.GDNStrings, New GDNStrings)

xslDocument.Transform(xmlDocument, params, urlResolver)


Current Thread