Search code examples
c#xmlxsltxslcompiledtransformaltova

XslCompiledTransform exception when using Altova MapForce-generated XSLT file


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?


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.