Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

CLR Xslt with msxml script failed Expand / Collapse
Author
Message
Posted Thursday, March 15, 2012 3:03 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, August 28, 2013 1:44 AM
Points: 1, Visits: 61
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
Post #1267884
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse