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/