View Single Post
Old 27-Feb-2007, 09:07 PM   #2 (permalink)
Sangeetha
Fixed Error!
 
Sangeetha's Avatar

Posts: 139
Location: Chennai
Join Date: Feb 2007
Rep Power: 2 Sangeetha is on a distinguished road

IM:
Default Re: simple xslt extension function

for C# you need the msxml parser of the dot net framework
(maybe that is not even called msxml, I am not sure)

Invalid class string is what you get when you have this function in C# in msxml4 standalone
in msxml6 the message would be: C# is not a scripting language :-)

either move to the XSLTransform of the .net framework
or use JScript in msxml4

The JScript variant would be

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="XSLT namespace"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:fubar="testing"
extension-element-prefixes="fubar"
exclude-result-prefixes="msxsl"
>
<xslutput method="xml" indent="yes"/>
<msxsl:script implements-prefix="fubar" language="JScript">
<![CDATA[
function exampleCall( str ){return str;}
]]>
</msxsl:script>
<xsl:template match="/">
<ps>
<xsl:apply-templates/>
</ps>
</xsl:template>
<xsl:template match="person">
<p><xsl:value-of select="fubar:exampleCall(name/last_name)" /></p>
</xsl:template>
</xsl:stylesheet>

note that I added a template to create a container element, otherwise your result is not wellformed
I changed @name into name/last_name, since name is not an attribute
and I excluded the msxsl namespace from propagating to the output
Sangeetha is offline   Reply With Quote