Solved

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

Posted on 2009-04-07
2
772 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

728 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