Julien
Julien

Reputation: 43

C# script in XSLT: "msxsl:script cannot be empty" error

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 !

Upvotes: 1

Views: 2732

Answers (3)

Julien
Julien

Reputation: 43

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">

Upvotes: 1

marc_s
marc_s

Reputation: 754478

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

Marc

Upvotes: 0

Jeff Martin
Jeff Martin

Reputation: 11022

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

Upvotes: 0

Related Questions