473,785 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Ser ver.MapPath("fi les/rdxmltemplate.x ml"))
Dim XSLTrans As New Xsl.XslTransfor m
XSLTrans.Load(S erver.MapPath(" files/nitf-rd.xsl"))
Dim ms As New MemoryStream
XSLTrans.Transf orm(XMLDoc, Nothing, ms, Nothing)
ms.Seek(0, SeekOrigin.Begi n)
Dim sr As New StreamReader(ms )
PageContent.Tex t = sr.ReadToEnd()
sr.Close()
Nov 11 '05 #1
3 2368
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****@aspallia nce.com
"Showjumper " <sh*******@grkj ashdjkf.com> wrote in message
news:u9******** ********@TK2MSF TNGP12.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(Ser ver.MapPath("fi les/rdxmltemplate.x ml"))
Dim XSLTrans As New Xsl.XslTransfor m
XSLTrans.Load(S erver.MapPath(" files/nitf-rd.xsl"))
Dim ms As New MemoryStream
XSLTrans.Transf orm(XMLDoc, Nothing, ms, Nothing)
ms.Seek(0, SeekOrigin.Begi n)
Dim sr As New StreamReader(ms )
PageContent.Tex t = 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****@aspallia nce.com

"Showjumper " <sh*******@grkj ashdjkf.com> wrote in message
news:u9******** ********@TK2MSF TNGP12.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(Ser ver.MapPath("fi les/rdxmltemplate.x ml"))
Dim XSLTrans As New Xsl.XslTransfor m
XSLTrans.Load(S erver.MapPath(" files/nitf-rd.xsl"))
Dim ms As New MemoryStream
XSLTrans.Transf orm(XMLDoc, Nothing, ms, Nothing)
ms.Seek(0, SeekOrigin.Begi n)
Dim sr As New StreamReader(ms )
PageContent.Tex t = 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****@aspalli ance.com> wrote in message
news:ej******** *****@tk2msftng p13.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****@aspallia nce.com
"Showjumper " <sh*******@grkj ashdjkf.com> wrote in message
news:u9******** ********@TK2MSF TNGP12.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(Ser ver.MapPath("fi les/rdxmltemplate.x ml"))
Dim XSLTrans As New Xsl.XslTransfor m
XSLTrans.Load(S erver.MapPath(" files/nitf-rd.xsl"))
Dim ms As New MemoryStream
XSLTrans.Transf orm(XMLDoc, Nothing, ms, Nothing)
ms.Seek(0, SeekOrigin.Begi n)
Dim sr As New StreamReader(ms )
PageContent.Tex t = 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
2491
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 I've hit a snag. How do I resolve multiple external references? The transform method on a stylesheet only takes one resolver, not an array Stephen
6
1656
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 reference the XSL files from the file system. The problem is that within the XSL file I have a reference to document(''), intending to "self reference" the stylesheet. As I mentioned above, this works fine as long as the stylesheet is file based;...
6
1730
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 XSLT file that does not work correctly is: <Token TokenId="3129"> <xsl:for-each select="EDI/Segment/Element"> <Value Segment="PRF" Position="1"> <xsl:attribute name="SegmentIndex"> <xsl:value-of select="../@SegmentIndex"/></xsl:attribute>
2
2153
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 URI is invalid, however if I open the file from the harddrive in the current directory, it works. Here's the method, notice that after s is loaded with the .xsl file from the resource stream that if you do a messagebox.show with s.readtoend you...
9
1585
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 IT ERRORS -- MessageBox.Show("after load") 'do the transform x.Transform(gsXpensePath, < XML file_name>, xr)
3
302
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 transformed) doesn't. In the transform file I load the 2nd XML file which contains
12
2921
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 the file. Here is the code snippet: XPathDocument xdoc = new XPathDocument(fs); XPathNavigator nav = xdoc.CreateNavigator(); xslt.Transform(nav, null, strWriter, null);
2
2072
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 can I in my C# appliction with a XSLT file get the data in notepad format. I know how to read and write *.doc and Xml files but Notepath format In C#? How Best Regard Kim S.
0
1021
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: <% 'Load XML set xml = Server.CreateObject("Microsoft.XMLDOM") xml.async = false
0
10324
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.