tags:

views:

778

answers:

3

Hello!

I have an XSLT with a C# script in it:

<msxsl:script language="C#" implements-prefix="user">
  <msxsl:using namespace="System.Xml"/>
  <msxsl:using namespace="System.Xml.XPath"/>
  <![CDATA[
    public string GetMenuPath(XPathNodeIterator node)
    {    
      XPathNavigator dataSourceNode = node.Current;
      return dataSourceNode.Name;
    }
  ]]>
</msxsl:script>

And somewhere in the XSLT this function is called:

<xsl:value-of select="user:GetMenuPath(current())"/>

But as I try to run the XSLT transformation on the XML input (the input does not matter), it stop immediately with the error "msxsl:script cannot be empty".

I have absolutely no idea why... I use nxslt with .NET Framework.

Thank you for help !

A: 

Does it give you the line that the transformation stops on? Is it where it is calling from or in the script tag?

Jeff Martin
No, so I tried to run it with the XSLT debugger of Visual Studio, and the transformation worked !
Julien
A: 

Have you tried putting your extension method into a separate assembly and referencing it that way?

Marc

marc_s
No, but this was not the cause, since it worked when running it in Visual Studio. But I found it out now !
Julien
A: 

Thank you for your answers, I found out the origin of the problem now. It was because I was using the "style" tag instead of "nxslt" for calling the XSLT transformation. "style" works as long as there is no extension script.

<nxslt style="transformation.xsl" in="input.xml" out="output.xls" verbose="true">
Julien