xsl-list
[Top] [All Lists]

RE: Microsoft xslt engine, calling from c#

2004-06-25 06:54:28
Hi Dave,

Why would you call a COM component instead of using .NET's System.Xml and
System.Xml.Xsl namespaces? The only reason I could think of is the better
performance of MSXML over XslTransform...

Anyway, you'd first add the MSXML reference to your C# project, by
right-clicking the Reference folder in the solution explorer, and choose the
COM Tab - then scroll down and choose the MSXML you want to add - then click
Select, and OK; this should then appear as 'MSXML2' in the reference list. 

After that you include the reference at the top of your code page:

using MSXML2;

Then you simply create an instance of the object you need (inside the public
class), for example:

MSXML2.FreeThreadedDOMDocument40Class ftd40 = new
FreeThreadedDOMDocument40Class();

Then, in the rest of your code you could have a button and a label, and load
an XML Source like this:

private void button1_Click(object sender, System.EventArgs e)
{
        string strXmlSource = @"C:\temp\input.xml";
        try
        {
                ftd40.load(strXmlSource);
        }
        catch (Exception exc)
        {
                label1.Text = exc.Message;
        }
}

Of course this is a very simple example, but it shows how you could start.
If you need more help just let us know.

HTH, 
<prs/>

-----Original Message-----
From: David(_dot_)Pawson(_at_)rnib(_dot_)org(_dot_)uk 
[mailto:David(_dot_)Pawson(_at_)rnib(_dot_)org(_dot_)uk] 
Sent: Friday, June 25, 2004 8:18 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Microsoft xslt engine, calling from c#

I'm *guessing* that the msxml xslt implementation can be called from c#
(somehow)?

Being totally ignorant of this,
could anyone provide a bit of code to do it for a couple of guys here whom
I'm introducing to xslt please?

TIA,


Regards DaveP.

**** snip here *****

--
DISCLAIMER: 

NOTICE: The information contained in this email and any attachments is
confidential and may be privileged. If you are not the intended recipient
you should not use, disclose, distribute or copy any of the content of it or
of any attachment; you are requested to notify the sender immediately of
your receipt of the email and then to delete it and any attachments from
your system. 

RNIB endeavours to ensure that emails and any attachments generated by its
staff are free from viruses or other contaminants. However, it cannot accept
any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments. 

Please note that the statements and views expressed in this email and any
attachments are those of the author and do not necessarily represent those
of RNIB. 

RNIB Registered Charity Number: 226227 

Website: http://www.rnib.org.uk 

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


<Prev in Thread] Current Thread [Next in Thread>