473,387 Members | 1,582 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,387 software developers and data experts.

Transform XML string using XSLT file


Hi,

I have in a string some XML and I want that xml to be transformed using XSLT
file (I found the way how to transform a xml file using XSLT but I didn’t
find a way how to transform using string)

Help me pls

thx in advance
Isambella
--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
4 3488
One method is to use XML web control
<asp:Xml id="xmlCtrl" runat="server" />

Load your stirng using LoadXml method of XmlDocument class and assign XML
and XSL objects to XML web control

XmlDocument oXML = new XmlDocument();
oXML.LoadXml(yourXmlString);

XslTransform oXSL = new XslTransform();
oXSL.Load(Server.MapPath("yourXslFileName.xsl"));

xmlCtrl.Document = oXML;
xmlCtrl.Transform = oXSL;
Sreejith

"Isambella via DotNetMonster.com" wrote:

Hi,

I have in a string some XML and I want that xml to be transformed using XSLT
file (I found the way how to transform a xml file using XSLT but I didn’t
find a way how to transform using string)

Help me pls

thx in advance
Isambella
--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #2
use the StringReader class to create a stream that can be passed xlst.

-- bruce (sqlwork.com)

"Isambella via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in message
news:52***********@DotNetMonster.com...

Hi,

I have in a string some XML and I want that xml to be transformed using
XSLT
file (I found the way how to transform a xml file using XSLT but I didn't
find a way how to transform using string)

Help me pls

thx in advance
Isambella
--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #3
Hi again

thx

I solve the problem, the answer is the following

------------------------------------------------------------------------------
-------------------------------------
str = "has the XML code"

Dim oTrasform As New XslTransform
Dim Resp As System.IO.Stream

Dim myDoc As New System.Xml.XmlDocument
Dim args As New XsltArgumentList

myDoc.LoadXml(str)

Dim txt As New System.IO.MemoryStream
Dim output As New System.Xml.XmlTextWriter(txt, System.Text.Encoding.UTF8)
oTrasform.Load(Get_Xslt_Formatter_Path())

oTrasform.Transform(myDoc, args, output, Nothing)

output.Flush()
txt.Position = 0

Dim sr As New StreamReader(txt)

textbox1.text = sr.ReadToEnd()
------------------------------------------------------------------------------
-------------------------------------
Bruce Barker wrote:
use the StringReader class to create a stream that can be passed xlst.

-- bruce (sqlwork.com)
Hi,

[quoted text clipped - 7 lines]
thx in advance
Isambella

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200508/1
Nov 19 '05 #4
Hi again

thx

I solve the problem, the answer is the following

------------------------------------------------------------------------------
-------------------------------------
str = "has the XML code"

Dim oTrasform As New XslTransform
Dim Resp As System.IO.Stream

Dim myDoc As New System.Xml.XmlDocument
Dim args As New XsltArgumentList

myDoc.LoadXml(str)

Dim txt As New System.IO.MemoryStream
Dim output As New System.Xml.XmlTextWriter(txt, System.Text.Encoding.UTF8)
oTrasform.Load(Get_Xslt_Formatter_Path())

oTrasform.Transform(myDoc, args, output, Nothing)

output.Flush()
txt.Position = 0

Dim sr As New StreamReader(txt)

textbox1.text = sr.ReadToEnd()
------------------------------------------------------------------------------
-------------------------------------
Bruce Barker wrote:
use the StringReader class to create a stream that can be passed xlst.

-- bruce (sqlwork.com)
Hi,

[quoted text clipped - 7 lines]
thx in advance
Isambella

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200508/1
Nov 19 '05 #5

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

Similar topics

5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
8
by: Luther Miller | last post by:
I am using the XML tranform functionality in .NET to transform data in a DataSet into XMLSS using an XSLT file I have created. There are about 100 columns and only about 120 rows in the data...
6
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process...
1
by: Owen | last post by:
Hello: I have some xml and xsl in string, "not in file". I want to transform the xml with xsl and the result I want in string (but in xml format). I read this sample : public class Sample {...
7
by: Doug Heeren | last post by:
I have the following section of VB.NET code that transforms a simple dataset into an Excel xml workbook. It works fine for < 50 rows or so, but I have about 8,000 rows I need to transform. Is there...
2
by: K riley | last post by:
Hi. I am using the transform method to create an HTML file using an existing XML Document and an XLST. I need to use XPath to extract a node from my XML Document and my XLST document will format...
3
by: Andy | last post by:
Hi all, I'm having a problem doing an Xslt transform in code. I've done it before, so I'm not really sure why its not working. The problem is that the result of the transform is an empty...
0
by: Terry Brown | last post by:
I have an xml file: <?xml version="1.0" encoding="utf-8" ?> <G2Registers xmlns="http://tempuri.org/registers.xsd"> <register> <name>Version Register</name> <address>"00000000"</address>...
1
by: Steve | last post by:
Using VB.NET 2.0 I have a simple routine that attempts transforms an XmlDocument with an XSLT stylesheet into HTML. Under the old 1.1 framework with XslTransform, everything worked fine. Now...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.