Link to home
Start Free TrialLog in
Avatar of ethar turky
ethar turkyFlag for Saudi Arabia

asked on

Error when use xsl-xslt-converter.xslt to convert xsl to xslt

Dear all
Need to convert xsl to xslt using xxsl-xslt-converter.xslt, but I got an error:
Windows Script Host
Script:      C:\Converter\convert.js
Line:      45
Char:      3
Error:      Microsoft JScript runtime error
Object required
line = 17, col = 6 (line is offset from the start of the script block).
Error returned from property or method call.

Code:      80020009
Source:       msxml3.dll


any one can help?
* please take a look at attached file, change the file extension to .rar instead of .txt
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

This is a very old project to transform old Working Draft XSL into XSLT
(that must have been relevant about 15 years ago)
Windows Scripting has evolved over this time, so it might be somewhat tricky to set it up
I looked inside the Javascript
There is no reason to use the javascript, you can simply run the XSLT on your XSL
using microsoft XSL (so simply drop the javasacript, take an IDE and run the XSLT over your XSL
You have not included the WS-XSL file, so I can't run it for you.
If you find an issue doing the XSLT, you can simply post it (or send it privately) so I can run the XSLT for you
Avatar of ethar turky


what is the WS-XSL ?
typo, I meant WD-XSL, Working Draft XSL (or what you call XSL)
its already included called x.xsl

but you can find it here again
no, no
The XSLT project you sent
transforms an XSL from th WD namespace:  xmlns:xsl=""
into one with a new xsl namespace:  xmlns:xsl=""

Your sample already has a  xmlns:xsl="" namespace,
so it does not need this transformation

I don't get the point of what you are trying to do

I remember from an old question that you had a large WD-XSL program (I believe you once said 40k lines?). That is what the code in the rar is for. to transform that old WD-XSL into something you can use and debug on modern IDE ("modern" equals "post 2001")

So, it is the 40k lines old stuff you need to use as the source of the XSLT inside the rar
by the way, the JS error likely comes from these constructs
new ActiveXObject("MSXML.DOMDocument");
recent msxml only have the dom object version 2
so you will need an old msxml3 to get that running
But again, forget the javascript, just use the XSLT
Dear Geert Bormans, thanks for your reply ...
Yes I know the xsl file I sent doesn't need any conversion , I just use it as a test.
Yes its same old large file , still straggling with it.

I will try your solution to use IDE only.

Well, you need to use a real WD XSL file to test of course,
if not there is nothing to transform

I believe you have XML SPY, no?
please don't use the XML spy processor, but use msxml to do the transform and you would be fine

The XSLT that will be generated will likely have msxsl extensions,
so after the transform, you would still be bound to microsoft xsl
If you ever need help to get rid of the microsoft extensions (xsl:script element) let us know, because you can simply make them redundant and use XSLT2... after that you can use xml spy at its best for debugging... that could come in handy for such a big XSLT
good , after massive tries I blocked with this error:
Exception Details: Microsoft.JScript.JScriptException: Function expected

[JScriptException: Function expected]
   Microsoft.JScript.LateBinding.Call(Binder binder, Object[] arguments, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters, Boolean construct, Boolean brackets, VsaEngine engine) +5705
   Microsoft.JScript.LateBinding.Call(Object[] arguments, Boolean construct, Boolean brackets, VsaEngine engine) +257
   System.Xml.Xsl.CompiledQuery.Script1.countNamespaceDecls(Object pNodeList) +703
   <xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current) +4028
   Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) +108
   Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) +47
   System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results) +132
   System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer) +311
   System.Xml.Xsl.XslCompiledTransform.Transform(XmlReader input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver) +83
   System.Xml.Xsl.XslCompiledTransform.Transform(String inputUri, String resultsFile) +304
   Compiler.ConvertOLDXSL2XSLT.btnConvert_Click(Object sender, EventArgs e) in c:\WebProjects\CodeCreator\Compiler\Compiler\ConvertOLDXSL2XSLT.aspx.cs:29
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +158
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +175
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +39
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +37
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +105
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4413

Open in new window

The function already exist in the xsl-xslt-converter.xslt

I use this to perform the conversion:
			XsltSettings mySettings = new XsltSettings() { EnableScript = true };
			XslCompiledTransform xslt = new XslCompiledTransform();
			xslt.Load(Server.MapPath(@"CG\\xsl-xslt-converter.xslt"), mySettings , null); //
			xslt.Transform(Server.MapPath(@"toconvert.xml"), Server.MapPath(@"convertedto.xslt"));

Open in new window

any idea

btw, yes I have xmlspy, and I never use it :)
I looked into some more detail in the XSLT you are using.
Honestly I am a bit disapointed, it is going to be hell to get your 40k lines migrated

- there is a whole bunch of javascript used as extension functions
- after that there is a whole lot of changes you need to make manually
- then the result is an XSLT with a whole bunch of javascript extension functions

So don't get your hopes too high

First you need to allow javascript functions inside your stylesheet I am afraid
Support for embedded scripts is an optional XSLT setting on the XslCompiledTransform class. Script support is disabled by default. To enable script support, create an XsltSettings object with the EnableScript property set to true and pass the object to the Load method.
"create an XsltSettings..."

This is what I already done in the code I show,
The js function I talked about is in xsl-xslt-converter.xslt  not in my code or in my xsl file

Yes my file is huge but contains straightforward js functions and few of them.
once we make the  xsl-xslt-converter.xslt   I can handle the conversion process manually, like divide the xsl file to small parts or so.
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial