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

ethar1 used Ask the Experts™
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
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Gertone (Geert Bormans)Information Architect
Top Expert 2006

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


what is the WS-XSL ?
Gertone (Geert Bormans)Information Architect
Top Expert 2006

typo, I meant WD-XSL, Working Draft XSL (or what you call XSL)
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.


its already included called x.xsl

but you can find it here again
Gertone (Geert Bormans)Information Architect
Top Expert 2006

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
Gertone (Geert Bormans)Information Architect
Top Expert 2006

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.

Gertone (Geert Bormans)Information Architect
Top Expert 2006

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 :)
Gertone (Geert Bormans)Information Architect
Top Expert 2006

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.
Gertone (Geert Bormans)Information Architect
Top Expert 2006



"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.
Information Architect
Top Expert 2006
Ah yes, I missed the first line of your XSLT call.

Using an IDE would give more information on the actual error in the XSLT
the code is calling a function it can't find.
That could be a namespace error
Are you calling the transform from a webpage through ASP
Try to avoid all the code around it, so we can concentrate on the actual transform only

What I am doing now is debugging on thin air
I suggest that you first make a small example of valid WD-XSL to start testing and that you send that sample in your next comment, because I can't rally help you much like this

The manual postprocessing is a lot more tha cutting the files by the way

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial