473,394 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Migrating XSL stylsheets with msxsl:script from MSXML4 to System.X

Hello guys,

I am having problems trying to migrate our MSXML4-compatible stylesheets
containing large msxsl:script blocks to a formate understandable by
System.Xml:Xsl.XslTransform. I keep getting JS1135 errors saying that some
variable was not declared. This scripts worked perfectly with MSXML4. Is
there a guide for migraiton from MSXML to .NET or can you just give me some
tips on how to resolve this issues without having to change dozens of
working, already tested and deployaed XSLTs?

Regards,
Eugen Gulinsky
Nov 12 '05 #1
3 3614

Eugen Gulinsky wrote:
I am having problems trying to migrate our MSXML4-compatible stylesheets
containing large msxsl:script blocks to a formate understandable by
System.Xml:Xsl.XslTransform. I keep getting JS1135 errors saying that some
variable was not declared. This scripts worked perfectly with MSXML4. Is
there a guide for migraiton from MSXML to .NET or can you just give me some
tips on how to resolve this issues without having to change dozens of
working, already tested and deployaed XSLTs?


Scripting is an extension to XSLT, don't expect that to be portable.
MSXML uses the Active Script engines for JScript or VBScript, .NET while
calling it msxsl:script uses one of the .NET languages and compiles,
even if you use JScript.NET it is a completely different implementation
to the COM based JScript.
What is more important, the object model your "script" operates on when
XSLT/XPath passes in nodes (node sets) is completely different, with
MSXML it is the MSXML XML DOM but within .NET it is not DOM at all, how
the XSLT/XPath types translate into .NET types is documented here:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXslXslTransformClassTopic.asp>

So you have
Node Set (XPath) as System.Xml.XPath.XPathNodeIterator
and
Result Tree Fragment (XSLT) as System.Xml.XPath.XPathNavigator
and need to use those APIs.
Note also that .NET 2.0 comes with a completely new XSLT implementation
though this document
<http://blogs.msdn.com/xmlteam/archive/2005/09/30/475922.aspx> claims
that migration from MSXML will be a bit easier as far as script is
concerned. But it also says
"In XslCompiledTransform a binding (method name lookup) to script
functions happens at compile time, and stylesheets that are compliable
with XslTranform may throw an exception during compilation with
XslCompiledTransform."
thus if you are now trying to move script in XSLT from MSXML to .NET
consider whether you do it in .NET 2.0 from the beginning.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
Hello Martin,

thanks for the fast reply. I also already realized there will be no easy
porting our stylesheets away from legacy MSXML. They make heavy use of the
IXSLProcessor.add_object method to set a custom functions library which is
then being used in the msxsl:script portions. What I will try to do now is to
use MSXML thru an interop assembly to instantiate the right COM objects like
stylesheet and XSLT processor. I will then provide the processor object with
an interop version of the custom functions library and hope the underlying
COM objects will work together ;-) I am of cource open for better suggestions.

Regards,
Eugen

"Martin Honnen" wrote:

Eugen Gulinsky wrote:
I am having problems trying to migrate our MSXML4-compatible stylesheets
containing large msxsl:script blocks to a formate understandable by
System.Xml:Xsl.XslTransform. I keep getting JS1135 errors saying that some
variable was not declared. This scripts worked perfectly with MSXML4. Is
there a guide for migraiton from MSXML to .NET or can you just give me some
tips on how to resolve this issues without having to change dozens of
working, already tested and deployaed XSLTs?


Scripting is an extension to XSLT, don't expect that to be portable.
MSXML uses the Active Script engines for JScript or VBScript, .NET while
calling it msxsl:script uses one of the .NET languages and compiles,
even if you use JScript.NET it is a completely different implementation
to the COM based JScript.
What is more important, the object model your "script" operates on when
XSLT/XPath passes in nodes (node sets) is completely different, with
MSXML it is the MSXML XML DOM but within .NET it is not DOM at all, how
the XSLT/XPath types translate into .NET types is documented here:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXslXslTransformClassTopic.asp>

So you have
Node Set (XPath) as System.Xml.XPath.XPathNodeIterator
and
Result Tree Fragment (XSLT) as System.Xml.XPath.XPathNavigator
and need to use those APIs.
Note also that .NET 2.0 comes with a completely new XSLT implementation
though this document
<http://blogs.msdn.com/xmlteam/archive/2005/09/30/475922.aspx> claims
that migration from MSXML will be a bit easier as far as script is
concerned. But it also says
"In XslCompiledTransform a binding (method name lookup) to script
functions happens at compile time, and stylesheets that are compliable
with XslTranform may throw an exception during compilation with
XslCompiledTransform."
thus if you are now trying to move script in XSLT from MSXML to .NET
consider whether you do it in .NET 2.0 from the beginning.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Nov 12 '05 #3
Eugen Gulinsky wrote:
I am having problems trying to migrate our MSXML4-compatible stylesheets
containing large msxsl:script blocks to a formate understandable by
System.Xml:Xsl.XslTransform. I keep getting JS1135 errors saying that some
variable was not declared. This scripts worked perfectly with MSXML4. Is
there a guide for migraiton from MSXML to .NET or can you just give me some
tips on how to resolve this issues without having to change dozens of
working, already tested and deployaed XSLTs?


In general there is no easy way. Haven't you been aware that writing
stylesheets that heavily rely on extentions makes them nonportable?
If you have dozens stylesheets, just leave them alone, what's wrong with
MSXML4?
If you still want to upgrade I recommend moving to .NET 2.0 and
XslCompiledTransform instead - JScript.NET 2.0 is more compatible with
JScript at syntax level.

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rolf Kemper | last post by:
Hi All, ned help on the example below. It works fine for msxml3/4 but has problems with saxon. Saxon complains "can not find matching function ..... " My target is to write style sheets...
1
by: Brandon Taylor | last post by:
Hi everyone, I'm using Visual Web Developer '05 beta, VB.NET, Access. I'm a complete newbie to .NET, so please bear with me! In classic ASP. I used to put my connection string in global.asa....
0
by: Iain | last post by:
I think my .net application may have the following memory leak: http://support.microsoft.com/default.aspx?scid=KB;EN- US;Q316775& I am calling c# code from an xslt script using the...
6
by: Shai Levi | last post by:
Hi, I'm trying to migrate native c++ class to managed c++ class. The native class header definition looks as: class NativeClass { public: typedef void (CbFunc1)(int n,void* p);
4
by: Collin Peters | last post by:
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the...
0
by: Andreas Zita | last post by:
Hi I am using <msxsl:script> a lot in my stylesheets and Im looking for a way of sharing one set of script methods (perhaps an assembly?) between all my stylesheets rather than having copies of...
0
by: pradeepap | last post by:
Hi, I am trying to return a form value from within a msxsl script. Please help me if i am doing it wrong. the code is as follows. <msxsl:script language="javascript" implements-prefix="user"> ...
6
by: phnimx | last post by:
I'm attempting to migrate a predominately MFC application that I've just inherited from Visual Studio.NET 2003 to Visual Studio 2005. I've managed to clean up a myriad of compile and link errors...
0
by: djnokturnal | last post by:
Hey! I am attempting to rewrite some old C# code in our code base that utilized DirectoryEntry to perform some LDAP queries. I am migrating it to the new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.