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

XSLT to merge two files

Hi,

the results should look like this example. But I dont know how the
stylesheet has to create.

Thanks for helping
Datei1.xml + Datei2.xml = Datei3.xml (results)


Datei1.xml

<?xml version="1.0" encoding="utf-8"?>
<document>
<row>
<Arbeitsplan-Nr.>AP11510-1</Arbeitsplan-Nr.>
<Bezeichnung>Winkelkabelschuhe 90° 5 - 10 mm˛ f</Bezeichnung>
</row>
<row>
<Arbeitsplan-Nr.>AP11512-1</Arbeitsplan-Nr.>
<Bezeichnung>Winkelkabelschuhe 90° 8 - 10 mm˛ f</Bezeichnung>
</row>
<row>
<Arbeitsplan-Nr.>AP11514-1</Arbeitsplan-Nr.>
<Bezeichnung>Winkelkabelschuhe 90° 12 - 10 mm˛ f</Bezeichnung>
</row>
</document>
Datei2.xml

<?xml version="1.0" encoding="utf-8"?>
<document>
<Pos>
<Arbeitsplan-Nr.>AP11510-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11510-S3</Arbeitsgang-Nr._des_Arbeitsga
nges>

<Position_des_Arbeitsganges_im_Arbeitsplan>10</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Pos>
<Arbeitsplan-Nr.>AP11512-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11512-S3</Arbeitsgang-Nr._des_Arbeitsga
nges>

<Position_des_Arbeitsganges_im_Arbeitsplan>10</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Pos>
<Arbeitsplan-Nr.>AP11512-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11512-P13</Arbeitsgang-Nr._des_Arbeitsg
anges>

<Position_des_Arbeitsganges_im_Arbeitsplan>20</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Pos>
<Arbeitsplan-Nr.>AP11512-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11512-P5</Arbeitsgang-Nr._des_Arbeitsga
nges>

<Position_des_Arbeitsganges_im_Arbeitsplan>30</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Pos>
<Arbeitsplan-Nr.>AP11514-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11514-S3</Arbeitsgang-Nr._des_Arbeitsga
nges>

<Position_des_Arbeitsganges_im_Arbeitsplan>10</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Pos>
<Arbeitsplan-Nr.>AP11514-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11514-P13</Arbeitsgang-Nr._des_Arbeitsg
anges>

<Position_des_Arbeitsganges_im_Arbeitsplan>20</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
</document>

Datei3.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document []>
<Arbeitsplan>
<Kopf>
<Arbeitsplan-Nr.>AP11510-1</Arbeitsplan-Nr.>
<Pos>
<Arbeitsplan-Nr.>AP11510-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11510-S3</Arbeitsgang-Nr._des_Arbeitsga
nges>

<Position_des_Arbeitsganges_im_Arbeitsplan>10</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Bezeichnung>Winkelkabelschuhe 90° 5 - 10 mm˛ f</Bezeichnung>
</Kopf>
<Kopf>
<Arbeitsplan-Nr.>AP11512-1</Arbeitsplan-Nr.>
<Pos>
<Arbeitsplan-Nr.>AP11512-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11512-S3</Arbeitsgang-Nr._des_Arbeitsga
nges>

<Position_des_Arbeitsganges_im_Arbeitsplan>10</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Pos>
<Arbeitsplan-Nr.>AP11512-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11512-P13</Arbeitsgang-Nr._des_Arbeitsg
anges>

<Position_des_Arbeitsganges_im_Arbeitsplan>20</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Pos>
<Arbeitsplan-Nr.>AP11512-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11512-P5</Arbeitsgang-Nr._des_Arbeitsga
nges>

<Position_des_Arbeitsganges_im_Arbeitsplan>30</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Bezeichnung>Winkelkabelschuhe 90° 8 - 10 mm˛ f</Bezeichnung>
</Kopf>
<Kopf>
<Arbeitsplan-Nr.>AP11514-1</Arbeitsplan-Nr.>
<Pos>
<Arbeitsplan-Nr.>AP11514-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11514-S3</Arbeitsgang-Nr._des_Arbeitsga
nges>

<Position_des_Arbeitsganges_im_Arbeitsplan>10</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Pos>
<Arbeitsplan-Nr.>AP11514-1</Arbeitsplan-Nr.>

<Arbeitsgang-Nr._des_Arbeitsganges>AG11514-P13</Arbeitsgang-Nr._des_Arbeitsg
anges>

<Position_des_Arbeitsganges_im_Arbeitsplan>20</Position_des_Arbeitsganges_im
_Arbeitsplan>
</Pos>
<Bezeichnung>Winkelkabelschuhe 90° 12 - 10 mm˛ f</Bezeichnung>
</Kopf>
</Arbeitsplan>

Oct 19 '05 #1
2 3016
Klaus Baumgart wrote:
the results should look like this example. But I dont know how the
stylesheet has to create.

Thanks for helping
Datei1.xml + Datei2.xml = Datei3.xml (results)


Use the document function.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Oct 19 '05 #2
Klaus Baumgart wrote:
Hi,

the results should look like this example. But I dont know how the
stylesheet has to create.

Thanks for helping
Datei1.xml + Datei2.xml = Datei3.xml (results)

[ snip: allot of xml ]

We are here not to give you a complete xsl file as a solution,
you can learn xsl yourself. if you have problems we can give solution,

the solution is already given: the document function.

More explanation:
<xs:variable name="datei1" select="document('./path/to/datei1.xml')"/>
<xs:variable name="datei2" select="document('./path/to/datei2.xml')"/>
Now you can refer to datei1 or 2 using
$datei1/a/xpath/expression/to/some/node

or $datei2/xpath/expression.

Hope it helps
Oct 19 '05 #3

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

Similar topics

1
by: Victor | last post by:
Hi, this might sound silly but I cannot figure out how to incorporate some XML of employees into some XML of a company to give new XML containing them all. For example, this is the company now ...
1
by: Yannick Patois | last post by:
Hi, I would like to merge two XML document, or more exacly enrich a document by inheritiong from another. I read a bit about XSLT and I know a bit of python/sax/dom, and I dont know where I...
2
by: bubbabudge | last post by:
Hi, I'm new to XSLT, so excuse my ignorance. How do I do something like this: <xsl:copy-of select="document('*.xml')"/> That is, I want to use the document function to merge all xml files in...
2
by: sam | last post by:
Hi, I've been buried in xsl and xslt articles for several days now, and am still unsure as to what I need to do... Basically, my vb.net app loads up an XML file from an external source...
0
by: joan | last post by:
Hi all, Let me explain my problem , I need to transform 1 xml file to html using Xsl , It works fine , but my problem is how to do it.I have 1 xml file and 4 xslts! divided in 2 groups. What I...
4
by: infiniti | last post by:
Hi, I am coming across problems in trying to EFFICIENTLY merge to XML files into one which involves transposing the rows into columns so that I can either generate a single flat xml file or store...
2
by: Stefan | last post by:
Hi there! I'm very new to XML and XSLT, so while working i encountered the following, probably very easy to solve, problem. i've got 2 XML-files, which look like this: LinesOfCode.xml:...
0
by: shapper | last post by:
Hello, I am transforming a XML file into another XML file using a XSLT. Everything is working fine! I have only one problem: I want one of the values in my XSLT file to be taken from a Key...
2
by: killy971 | last post by:
I have been testing different libraries to process XSL transformations on large XML files. The fact is that I read a document from Intel, stating their library (XSLT accelerator) was more twice...
12
by: blackirish | last post by:
Hi all, I am trying to merge 2 XML files that first of all i need to compare nodes of both files according to 2 attributes in the nodes. If those 3 attributes are equal, i need to replace the...
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...
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...
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
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
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...
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...

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.