473,406 Members | 2,698 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,406 software developers and data experts.

How to transform an xml file with 2 xsl files?

I need to do a transform using 2 xsl files? How would i go about this? This
is what am doing now - just a single transform.
Dim XMLDoc As New XmlDocument
XMLDoc.Load(Server.MapPath("files/rdxmltemplate.xml"))
Dim XSLTrans As New Xsl.XslTransform
XSLTrans.Load(Server.MapPath("files/nitf-rd.xsl"))
Dim ms As New MemoryStream
XSLTrans.Transform(XMLDoc, Nothing, ms, Nothing)
ms.Seek(0, SeekOrigin.Begin)
Dim sr As New StreamReader(ms)
PageContent.Text = sr.ReadToEnd()
sr.Close()
Nov 11 '05 #1
3 2345
You mean you need to do it in two phases? In that case use the result of
first transformation as input for the second transformation. XmlDocument for
example can load the XML from Stream (say MemoryStream that was target
stream of the first transformation) abd you could use it again as input.

But if the need was to have to separate transformation, then use the same
XMLDocument as source for both and after doing the first transformation and
outputting results load the second XSLT stylesheet to the XslTransform and
redo the transformation.

If you need more specific information, plase tell bit more about your case.

--
Teemu Keiski
MCP, Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com

Email:
jo****@aspalliance.com
"Showjumper" <sh*******@grkjashdjkf.com> wrote in message
news:u9****************@TK2MSFTNGP12.phx.gbl...
I need to do a transform using 2 xsl files? How would i go about this? This is what am doing now - just a single transform.
Dim XMLDoc As New XmlDocument
XMLDoc.Load(Server.MapPath("files/rdxmltemplate.xml"))
Dim XSLTrans As New Xsl.XslTransform
XSLTrans.Load(Server.MapPath("files/nitf-rd.xsl"))
Dim ms As New MemoryStream
XSLTrans.Transform(XMLDoc, Nothing, ms, Nothing)
ms.Seek(0, SeekOrigin.Begin)
Dim sr As New StreamReader(ms)
PageContent.Text = sr.ReadToEnd()
sr.Close()

Nov 11 '05 #2
And in addition see Oleg Tkachenko's message in thread:

"Do transformation output to string or xmlDoc and not a file or
xmltextwriter"

a couple of threads below this one
--
Teemu Keiski
MCP, Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com

Email:
jo****@aspalliance.com

"Showjumper" <sh*******@grkjashdjkf.com> wrote in message
news:u9****************@TK2MSFTNGP12.phx.gbl...
I need to do a transform using 2 xsl files? How would i go about this? This is what am doing now - just a single transform.
Dim XMLDoc As New XmlDocument
XMLDoc.Load(Server.MapPath("files/rdxmltemplate.xml"))
Dim XSLTrans As New Xsl.XslTransform
XSLTrans.Load(Server.MapPath("files/nitf-rd.xsl"))
Dim ms As New MemoryStream
XSLTrans.Transform(XMLDoc, Nothing, ms, Nothing)
ms.Seek(0, SeekOrigin.Begin)
Dim sr As New StreamReader(ms)
PageContent.Text = sr.ReadToEnd()
sr.Close()

Nov 11 '05 #3
I am using the NITF DTD. One xsl is for the <body.head> and the other xsl is
for the <body.content>
"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:ej*************@tk2msftngp13.phx.gbl...
You mean you need to do it in two phases? In that case use the result of
first transformation as input for the second transformation. XmlDocument for example can load the XML from Stream (say MemoryStream that was target
stream of the first transformation) abd you could use it again as input.

But if the need was to have to separate transformation, then use the same
XMLDocument as source for both and after doing the first transformation and outputting results load the second XSLT stylesheet to the XslTransform and
redo the transformation.

If you need more specific information, plase tell bit more about your case.
--
Teemu Keiski
MCP, Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com

Email:
jo****@aspalliance.com
"Showjumper" <sh*******@grkjashdjkf.com> wrote in message
news:u9****************@TK2MSFTNGP12.phx.gbl...
I need to do a transform using 2 xsl files? How would i go about this?

This
is what am doing now - just a single transform.
Dim XMLDoc As New XmlDocument
XMLDoc.Load(Server.MapPath("files/rdxmltemplate.xml"))
Dim XSLTrans As New Xsl.XslTransform
XSLTrans.Load(Server.MapPath("files/nitf-rd.xsl"))
Dim ms As New MemoryStream
XSLTrans.Transform(XMLDoc, Nothing, ms, Nothing)
ms.Seek(0, SeekOrigin.Begin)
Dim sr As New StreamReader(ms)
PageContent.Text = sr.ReadToEnd()
sr.Close()


Nov 11 '05 #4

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

Similar topics

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...
6
by: Bill Cohagan | last post by:
I've got a c# app that does some transforms using XSL files that are stored as Embedded Resources in the app. That turns out to be significant; i.e., the problem I've encountered goes away if I...
6
by: tcdevelopment | last post by:
I have a XSLT file that gives expected results when I transform using MSXML V4.0 in a simple vbs file. However when using XslTransform in dotnet, I do not get the same results. The part of the...
2
by: Greg Merideth | last post by:
I have an XSL file that I am using to transform some XML data using this method below. The problem is that if I use an embedded .XSL file in the .NET assembly, I get an error indicating that the...
9
by: Doug Stiers | last post by:
I have this vb.net (framework 1.1) code: Dim x As Xml.Xsl.XslTransform = New Xml.Xsl.XslTransform Dim xr As XmlResolver MessageBox.Show("before load") x.Load(<xsl file name>) -- THIS IS WHERE...
3
by: Peter Row | last post by:
Hi, I have 2 XML files and 1 XSLT file. The second XML file has the following declarative 1st line: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> ....the 1st one (the one to be...
12
by: das | last post by:
Hello all, I am using .NET XSLT to transform an XML into another XML file. All this is fine with small files, but when tested with big files (30MB) it is taking between 1hr-2hrs to just transform...
2
by: =?Utf-8?B?S2lt?= | last post by:
HowHi all I want to transform data in xml files to *.txt in a C# application. I have some data in Xml files and want to used them in a 3D tool to print the subject I know little about XSLT, so...
0
by: Steerman | last post by:
Hi I have this upload script. It works fine. I can upload files etc, but i want to transform the files after the upload. I just don't know how to do it. This is my transformation file: <%...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.