?
Solved

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

Posted on 2009-04-07
2
Medium Priority
?
777 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 200 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

770 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