Register  Login       Search  
Forum  
 
  
 
Forum  Forum     
 
SearchForum Home
  XML Lab Products  nxslt  msxsl:script ca...
 msxsl:script cannot be empty
 
ODA
1 posts
Joined
7/10/2006

msxsl:script cannot be empty
Posted: 10 Jul 06 6:23 AM (Russian Federation)
Hi, Oleg.

Test example for NXSLT.EXE:
accnumber.xml ------
<?xml version='1.0'?>
<data>
  <account>
    <accnum>10205</accnum>
  </account>
  <account>
    <accnum>20202</accnum>
  </account>
</data>

calcacc.xslt ------
<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">
  <msxsl:using namespace="System"/>
  <msxsl:using namespace="System.IO"/> 
     <![CDATA[
        private bool IsAcc(string strAcc)
        {
                    bool myIsFind = false;
                    string strTmp = "";
                    string FileName = "C:\\acc.txt";

                    FileStream myStrm = File.Open(FileName);

                    if( myStrm != null )
                     {
                        StreamReader myreader = new StreamReader(myStrm);

                        while( (strTmp = myreader.ReadLine()) != null )
                         {
                            Console.WriteLine("str: {0}", strTmp);
                         }

                        myStrm.Close();
                     }

                    return myIsFind;
        }
      ]]>
   </msxsl:script>

  <xsl:template match="data"> 
  <accounts>

  <xsl:for-each select="account">
    <account>
    <xsl:copy-of select="node()"/>
       <calcacc>
          <xsl:value-of select="user:IsAcc(accnum)"/>       
       </calcacc>
    </account>
  </xsl:for-each>
  </accounts>
  </xsl:template>
</xsl:stylesheet>

Running the following command:
nxslt.exe accnumber.xml calcacc.xslt -o calcacc.xml

Problems:
Error occurred while compiling stylesheet 'calcacc.xslt'.
---> System.Xml.Xsl.XsltException: msxsl:script cannot be empty

I'm using
.NET XSLT command line utility, version 1.6.4
(c) 2004-2005 Oleg Tkachenko, http://www.xmllab.net
Running under .NET 1.1.4322.573



olegt
85 posts
www.xmllab.net
Joined
2/25/2005

Re: msxsl:script cannot be empty
Posted: 11 Jul 06 1:36 AM (Israel)
You are using <msxsl:using>, which is supported only in .NET 2.0. So you have to use nxslt2 (nxslt v2.0.1 current version) instead.

Oleg Tkachenko, Microsoft MVP for XML, MCPD
http://www.XmlLab.Net | http://blog.tkachenko.com
  XML Lab Products  nxslt  msxsl:script ca...
Forum Home  Search