Question

I'm using .NET's XslCompiledTransform to perform an XSLT transformation. When I try using an XSLT file I've automatically generated using Altova's MapForce tool, I get the exception:

XSL conversion is failed: Cannot find the script or external object that implements prefix 'http://www.altova.com/xslt-extensions'.

From the XSL Stylesheet definition:

<xsl:stylesheet ... xmlns:ns0="http://www.altova.com/xslt-extensions" ... >

...it seems that Altova defines its own extension functions to XSLT, and the XslCompiledTransform doesn't know how to find them. How can I make the XslCompiledTransform recognize those external functions?

Was it helpful?

Solution

Usually extensions are not portable, only some EXSLT extensions like exsl:node-set are supported by a wide range of XSLT 1.0 processors, including XslCompiledTransform. If you develop with XML Spy and want to execute its stylesheets with .NET code then you can consider to use AltovaXML with .NET, see http://manual.altova.com/AltovaXML/altovaxmlcommunity/index.html?axnetinterface.htm, instead of using XslCompiledTransform.

OTHER TIPS

I don't know any details of Mapforce, but I do know that people successfully run Mapforce generated stylesheets with Saxon. Perhaps (I'm speculating) if you ask mapforce to generate a 2.0 stylesheet, then it won't need any Altova extensions, and you can then run the stylesheet with a 2.0 processor such as Saxon or XmlPrime.

(Incidentally, Microsoft have made it quite clear that they aren't planning to upgrade XsltCompiledTransform to XSLT 2.0, so you are using a dead-end technology. Saxon, Altova, and XmlPrime are all moving forward; Saxon and XmlPrime not only support XSLT 2.0 but large chunks of 3.0 as well. There are an awful lot of productivity benefits you are missing out on.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top