Solved

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

Posted on 2009-04-07
2
759 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
New to SOAP and need some direction 10 46
Vb.net dynamic formulas in runtime 11 62
Syntax Error 2 46
SQL Login 17 40
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
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…

920 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

14 Experts available now in Live!

Get 1:1 Help Now