Solved

How do I link/embed XSLT file and access the resource?

Posted on 2009-04-07
2
757 Views
Last Modified: 2013-12-17
I am creating a windows application to select an XML file and use an XSLT template to apply formatting to that XML file.

I can currently provide a static path to the file, but I'd like to create a resource for this XSLT file so that I don't have to include the file after I compile the application.

I can't figure out how to use XslCompiledTransform's Load method to access a .resx file "Template.xsl" to load that file.

For sake of simplicity, assume namespace = ns and resource path = ns.Resources.Template.xsl

Any help would be great.
0
Comment
Question by:tbhodges
2 Comments
 

Accepted Solution

by:
tbhodges earned 0 total points
ID: 24093499
I answered my own question I believe...

Read the ns.Resources.Template.xsl into a stream, and then created an XmlTextReader from the stream.    The Load method can take an XmlReader.

Let me know if you think of anything else that could be easier.
Stream myXSL = Assembly.GetExecutingAssembly().GetManifestResourceStream("ns.Resources.Template.xsl");
 

XmlReader myReader = new XmlTextReader(myXSL);

Open in new window

0
 
LVL 19

Assisted Solution

by:daveamour
daveamour earned 50 total points
ID: 24097923
Thats a bit clunky
This is better
http://msdn.microsoft.com/en-us/library/7k989cfy(VS.80).aspx
But when it says this:

You can add resources to a project by right-clicking the Properties node under your project in Solution Explorer, clicking Open, and then clicking the Add Resource button on the Resources page in Project Designer.
I thin that's wrong and you should right click on the Resources.resx in Properties
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now