Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7799645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:22:47+00:00 2026-06-02T00:22:47+00:00

I have some legacy XSLT scripts that incorporate VBScript in them. They are run

  • 0

I have some legacy XSLT scripts that incorporate VBScript in them. They are run on an old system and I can’t change that system.

I am required to make a change to an XSLT to transform a file differently now.

I built a simple .NET project to test my XSLT transform:

    [STAThread]
    public static void Main(string[] args)
    {
        var transform = new XslCompiledTransform(true);
        //foreach (var file in System.Reflection.Assembly
        //    .GetExecutingAssembly().GetManifestResourceNames()
        //    )
        //{
        //    Console.WriteLine(file);
        //}
        //Console.ReadKey();


        transform.Load(XmlTextReaderFromEmbeddedResource("MyXSLTFile"),
            new XsltSettings() { EnableDocumentFunction = true, EnableScript = true }, new XmlUrlResolver());
        transform.Transform(
            XmlTextReaderFromEmbeddedResource("MySourceXML"),
            ToXmlTextWriter("MyOutput.xml"));

    }

    private static XmlTextReader XmlTextReaderFromEmbeddedResource(string resourceName)
    {
        var resource = typeof(Transform)
            .Assembly.GetManifestResourceStream
            (resourceName);
        return new XmlTextReader(resource);
    }

    private static XmlTextWriter ToXmlTextWriter(string fileName)
    {
        return new XmlTextWriter(fileName, Encoding.UTF8);
    }

this works, procedurally. However, the scripts in the XSLT, being VBScript, aren’t playing well with .NET. Specifically, I have a segment:

dim gRegEx
set gRegEx = New RegExp

which bombs the transform as:

Type 'RegExp' is not defined.

There’s lots of articles about how to convert this to a .NET object, but this needs to go back to a legacy machine that will be expecting VBScript.

How can I write this so that it will work in both environments?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:22:48+00:00Added an answer on June 2, 2026 at 12:22 am

    The simplest approach to avoid using XslCompiledTransform. Instead use COM-Interop to utalise MSXML3 or MSXML6 to perform the transform. That way its much more likely that the transform as performed hosted in .NET will do the same when the transform is performed in classic ASP.

    Edit:

    Example.

    Create a Windows Console C# Project

    Add a reference to the COM Component Name “Microsoft XML, v3.0”.

    Include this code:-

    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var dom = new MSXML2.DOMDocument30();
                dom.async = false;
                dom.load(args[0]);
    
                var xslt = new MSXML2.DOMDocument30();
                xslt.async = false;
                xslt.load(args[1]);
    
                File.WriteAllText(args[2], dom.transformNode(xslt));
    
                Console.WriteLine("Done");
    
            }
            finally
            {
                Console.ReadKey();
            }
        }
    
    }
    

    Now in the project properties Debug tab add the three command line parameters, the file path to the input XML, the XSLT file to transform it and the output file path.

    You can now incoporate this in a larger .NET project that can make use of an XSL designed for use by ASP Classis and/or that contains older MS script code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some legacy DB with many tables (around 100) the old system is
I have some 'legacy' code (which I can't change, but need to add on
We have some legacy ASP.NET code that detects if a request is secure, and
I have some legacy code that was used to monitor my applications cpu,memory etc
I have some legacy C++ code that I am trying to understand a bit
I have some data (produced by a legacy application) that I know is invalid
I have some files that are uuencoded, and I need to decode them, using
Currently I have some legacy ASP.NET 2.0 code that uses the ASP Xml web
I have some legacy code that contains this typedef: typedef enum simple_op_enum { #define
I have some legacy code that uses Interlocked.Equals to compare values. The values may

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.