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

---------------------------
OK  
---------------------------

any one can help?
* please take a look at attached file, change the file extension to .rar instead of .txt
C--Converter-Converter.txt
ethar1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
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
ethar1Author Commented:
what is the WS-XSL ?
Gertone (Geert Bormans)Information ArchitectCommented:
typo, I meant WD-XSL, Working Draft XSL (or what you call XSL)
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

ethar1Author Commented:
its already included called x.xsl

but you can find it here again
C--Converter-x.xsl
Gertone (Geert Bormans)Information ArchitectCommented:
no, no
The XSLT project you sent
transforms an XSL from th WD namespace:  xmlns:xsl="http://www.w3.org/TR/WD-xsl"
into one with a new xsl namespace:  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Your sample already has a  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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 ArchitectCommented:
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
ethar1Author Commented:
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.

thanks
Gertone (Geert Bormans)Information ArchitectCommented:
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
ethar1Author Commented:
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 ArchitectCommented:
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 ArchitectCommented:
ethar1Author Commented:
"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.
Gertone (Geert Bormans)Information ArchitectCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.