Avatar of ethar turky
ethar turky
Flag 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

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

Avatar of undefined
Last Comment
Gertone (Geert Bormans)

8/22/2022 - Mon
Gertone (Geert Bormans)

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
ethar turky

ASKER
what is the WS-XSL ?
Gertone (Geert Bormans)

typo, I meant WD-XSL, Working Draft XSL (or what you call XSL)
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ethar turky

ASKER
its already included called x.xsl

but you can find it here again
C--Converter-x.xsl
Gertone (Geert Bormans)

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)

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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ethar turky

ASKER
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)

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
ethar turky

ASKER
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 :)
Your help has saved me hundreds of hours of internet surfing.
fblack61
Gertone (Geert Bormans)

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)

ethar turky

ASKER
"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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Gertone (Geert Bormans)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.