470,833 Members | 1,757 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

"the uri scheme is not valid" error when working with XslTransformload method

Hi All

I've decided to put my stylesheets in a base64 .resource file for
deployment and versioning reasons. I dont know if it's a great idea to
do this but I couldn't think of another way of doing this other than
making them available via www which may or may not be accessible (so
this is a no go). Bear with me because I've only been using C# for one
day so far (today is day 2! wohoo).

// begin code snippet

XslTransform xslt = new XslTransform();

// put stylesheet in a string variable
ResourceManager rManager=newResourceManager("abcd.StyleSheets",
Assembly.GetExecutingAssembly());

//Load the stylesheet.
xslt.Load(resourceManager.GetString("0"));

// end code snippet

Here I get an error on the Load method which I'm guessing is because the
load method expects a filename not the raw XML.

Is there a method which accepts raw XML within the System.Xml.Xsl?
A LoadXML method would be what I'm looking for, alternatively if some
kind soul could offer me some opinion on some other way to do what I need?
Apr 19 '06 #1
2 4065


Mr Flibble wrote:

XslTransform xslt = new XslTransform();

// put stylesheet in a string variable
ResourceManager rManager=newResourceManager("abcd.StyleSheets",
Assembly.GetExecutingAssembly());

//Load the stylesheet.
xslt.Load(resourceManager.GetString("0")); Is there a method which accepts raw XML within the System.Xml.Xsl?
A LoadXML method would be what I'm looking for,


If that method gives you a string with the XML markup of the XSLT
stylesheet then you can use an XmlTextReader over a StringReader e.g.
xslt.Load(new XmlTextReader(new
StringReader(resourceManager.GetString("0")))

Note also that with ASP.NET 1.1 some overloads of the Load method are
obsolete, you might want to use a method taking additional parameters
(besides the XmlReader) where you pass in an XmlResolver and Evidence to
control how xsl:include/import are resolved and how/whether script in
the stylesheet is allowed.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Apr 19 '06 #2

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:Ox**************@TK2MSFTNGP05.phx.gbl...


Mr Flibble wrote:

XslTransform xslt = new XslTransform();

// put stylesheet in a string variable
ResourceManager rManager=newResourceManager("abcd.StyleSheets",
Assembly.GetExecutingAssembly());

//Load the stylesheet.
xslt.Load(resourceManager.GetString("0"));

Is there a method which accepts raw XML within the System.Xml.Xsl?
A LoadXML method would be what I'm looking for,


If that method gives you a string with the XML markup of the XSLT
stylesheet then you can use an XmlTextReader over a StringReader e.g.
xslt.Load(new XmlTextReader(new
StringReader(resourceManager.GetString("0")))

Note also that with ASP.NET 1.1 some overloads of the Load method are
obsolete, you might want to use a method taking additional parameters
(besides the XmlReader) where you pass in an XmlResolver and Evidence to
control how xsl:include/import are resolved and how/whether script in the
stylesheet is allowed.


Yeah, I used this:

XslTransform transform = new XslTransform();
XmlTextReader textReader = new XmlTextReader(strXSLT, XmlNodeType.Document,
null);
transform.Load(textReader, null, null);

where strXSLT contains the XSLT XML markup as a string!
Apr 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Jim Bancroft | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.