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

  • Thread starter Thread starter Mr Flibble
  • Start date Start date
M

Mr Flibble

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?
 
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 said:
Mr Flibble wrote:




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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top