473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

load a string with XslTransform

how can I load a XSL string (not an xsl file!!) with XslTransform ???

If I use the code:

// Create a new XslTransform class and load the stylesheet
XslTransform myXslTransform = new XslTransform();
myXslTransform.Load("myFile.xsl");

it run, but I need load an XSL string:

XslTransform myXslTransform = new XslTransform();

xslString='<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="urn:var"
xmlns:userVBScript="urn:userVBScript"
xmlns:userJScript="urn:userJScript" exclude-result-prefixes="msxsl var
userVBScript userJScript" version="1.0"><xsl:output method="xml"
omit-xml-declaration="yes"/><xsl:template
match="/"><xsl:apply-templates
select="parameters"/>..........etc.etc.';

myXslTransform.Load(xslString);

and it doesn't run.
thanks,
manlio
Nov 16 '05 #1
1 2760
manilo,

In .NET 1.1, you would take a StringReader, and pass that to an
XmlTextReader, and then pass that XmlTextReader to the XslTransform class
instance.

In .NET 2.0, that method is marked as obsolete, but there is an overload
which takes an XmlReader, an XmlResolver and Evidence (it's a more secure
method).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"manlio" <m.*********@offnet.it> wrote in message
news:58*************************@posting.google.co m...
how can I load a XSL string (not an xsl file!!) with XslTransform ???

If I use the code:

// Create a new XslTransform class and load the stylesheet
XslTransform myXslTransform = new XslTransform();
myXslTransform.Load("myFile.xsl");

it run, but I need load an XSL string:

XslTransform myXslTransform = new XslTransform();

xslString='<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="urn:var"
xmlns:userVBScript="urn:userVBScript"
xmlns:userJScript="urn:userJScript" exclude-result-prefixes="msxsl var
userVBScript userJScript" version="1.0"><xsl:output method="xml"
omit-xml-declaration="yes"/><xsl:template
match="/"><xsl:apply-templates
select="parameters"/>..........etc.etc.';

myXslTransform.Load(xslString);

and it doesn't run.
thanks,
manlio

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Christopher Ambler | last post by:
This has to be a FAQ, but I can't seem to find the answer anywhere! I have an application that consumes a web service that returns me a string full of XML. I also have an XSLT for outputting the...
2
by: Matt Frame | last post by:
I am building dynamic XSL using a string varible in VB.Net with information in code and from a database field. I am having a difficult time finding the correct object to load the string into to...
3
by: Torrent | last post by:
When Trying to Load an XSLT File with the XslTransform i got a rather annoying Exception being thrown "System.Xml.XPath.XPathException: XsltContext is needed for this query because of an unknown...
5
by: Kevin Westhead | last post by:
I'm using XslTransform to apply a transform to an XML document, however I get validation problems when parsing the resulting XML document due to invalid whitespace. I'm passing in an XPathNavigator...
0
by: Robert Gaut | last post by:
I have a Windows service that reads messages off a message queue and performs several XSL transforms per message. The XSL documents are embedded resources in the executing assembly and several...
3
by: Paul Hatcher | last post by:
Hi I have a transform going from XML to HTML, but I can't seem to get the XslTransform class to output &amp; as & even when using disable-output-escaping. I've tried writing the result to a...
4
by: Mike Schilling | last post by:
In 1.0, there was a method call: XslTransform.Load(IXPathNavigable, XmlResolver) In 1.1, compiling a call to it gives a warning that this signature is obsolete and evidence should be suppied,...
1
by: Baren | last post by:
Hi! I have the following code in VB.NET ******** Dim mydata As New XmlDocument Dim xslt As New XslTransform mydata.Load("C:\Inetpub\wwwroot\VBTestProj\Sample.xml")...
2
by: Mr Flibble | last post by:
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.