CLR Xslt with msxml script failed

  • Hi,

    I have assembly that transform xml but i have a problem with script element

    <xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:msxsl="urn:schemas-microsoft-com:xslt"

    xmlns:user="urn:my-scripts">

    <msxsl:script language='C#' implements-prefix='user'>

    <![CDATA[

    public string replace(string inStr, string pattern,string replacement){

    return inStr.Replace(pattern,replacement);

    }

    ]]>

    </msxsl:script>

    <xsl:template match="/">

    <ahoj><xsl:value-of select="user:replace(/ROOT/RECORD,'hello','bye')" /></ahoj>

    </xsl:template>

    </xsl:stylesheet>

    --------------------------------------------------------------

    <ROOT>

    <RECORD>hello , bye</RECORD>

    </ROOT>

    --------------------------------------------------------------

    When i call assembly i get this error

    A .NET Framework error occurred during execution of user-defined routine or aggregate "GetTransform":

    System.Xml.Xsl.XslTransformException: Cannot find a script or an extension object associated with namespace 'urn:my-scripts'.

    System.Xml.Xsl.XslTransformException:

    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)

    at <xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)

    at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)

    at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)

    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)

    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)

    at System.Xml.Xsl.XslCompiledTransform.Transform(XmlReader input, XsltArgumentList arguments, Stream results)

    at Transformation.MyTransformation(SqlXml xmlData, SqlXml xsltData, SqlXml& retSqlXml)

    ---------------------------------------------------------------------------------------

    Can you help me with this? assembly works fine ,but when i use c# in xslt i get error

    I'm sorry for my english 🙂

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply