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

Combine portions of multiple xml files into 1 xml file using xsl i

PK9
I'm building a windows app using C#. The goal is to merge portions of
multiple xml files into one.

I currently have an .xsl stylesheet that pulls in the required sections of
multiple xml files and combines them into one xml file. This xsl works
correctly.

I'm now trying to utilize this xsl in my C# application, along with the
required xml files, to merge them into the one document. Basically I'm
looking for a code example of how to apply the xsl style sheet to the
documents and create a single xml file.

I started working with the XslTransform.Transform method, but it's my
understanding that this only applies to a single xml document. My example
below works if the XSL stylesheet only references a single xml document, but
I need to be able to work with multiple documents:
string strXMLPath = "C:\\XML\\XML Files\\IS\\Management\\Management.xml";
string strXSLPath = "C:\\XML\\StyleSheets\\Application\\MgmtStyles.xsl ";

//Instantiate the XPathDocument class
XPathDocument xmlDoc = new XPathDocument(strXMLPath);
//Instantiate the XSLTransform class
XslTransform transform = new XslTransform();

transform.Load(strXSLPath);
XmlTextWriter writer = new XmlTextWriter("C:\\XML_FILES\\XML Data
Files\\IS\\Management\\TEMP.xml",null);
transform.Transform(xmlDoc,null,writer);


--
PK9
Jan 18 '06 #1
1 9948
PK9 wrote:
I'm building a windows app using C#. The goal is to merge portions of
multiple xml files into one.


You've got at least two options:
1. Load additional XML documents in XSLT stylesheet using document()
function.
2. "merge portions of multiple xml files into one" using XInclude. Take
a look at "Combining XML Documents with XInclude" at
http://msdn.microsoft.com/library/en...l/xinclude.asp

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com
Jan 19 '06 #2

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

Similar topics

2
by: Knighterrant | last post by:
How to combine multiple xml files into a single one, or split an xml file into multiple files using xslt?
4
by: PZWU | last post by:
How can I build a big XML file by appending a few smaller xml files in C#? Below is what I've been trying: /* FileString.xml is the path and name string of the big xml file*/ XmlTextWriter...
3
by: Arun | last post by:
Hi, I have simple question to ask. How to write multiple Binary files to the Browser using Asp.Net and Visual C#.net I have seen examples where single binary file is written to browser. ...
8
by: frekster | last post by:
Hi. I used to be able to do this easily in vb 6 via looping and preserving the source array data/size etc. How can I do this in vb.net? I've been trying for a while now and this should be...
6
by: :) | last post by:
How to combine serveral large .txt files in C# without using MS command line. Thanks!!
1
by: Sergio | last post by:
Hello everybody. Somebody has given me nine files with some data for the years 1997, 1998, ... , 2005. They are 9 different mdb files. Each one has many tables, forms, and other things. But all...
4
by: kumar_ps | last post by:
I am using vb6.0 here i am using "tif" files my program is i am keeping some tif files in a folder. when i run the program that all the tif files combine one file. i mean suppose we take 4tif files...
7
by: SNN | last post by:
Hi, I have 4 files that I would like to combine side by side and the seperater is tab in these four files. I also would like to have the output file to be tab delimited. All 4 files have the same...
4
by: IT Couple | last post by:
Hi I'm pretty new to SSIS and I wonder if you could help me. I download HTML files (thounsands) as text files using SSIS and then using foreach loop I load each file into table text data type...
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:
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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...

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.