[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: union elements in multiple xml documents

Subject: Re: union elements in multiple xml documents
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 Sep 2000 10:00:50 +0200 (MET DST)
xsl merge xml union
Hi,

> I'm looking into ways to combine more than one xml documents together. 
> For example: I have one xml document:
> <stock ticker="csco">
>    <last />
>    <date />
>    <change />
>    <open />
>    <high />
>    <volume />
> <stock>
> 
> Another xml document:
> <stock ticker="csco">
>    <highest />
>    <lowest />   
>    <average-volume />
> <stock>
> 
> I want to result document has elements from both. Any suggestions anyone?

The fundamental function you're needing here is document().
So, for example, if your file are named stock1.xml and stock2.xml,
you can access the nodes from these XML sources with
document('stock1.xml') resp. document('stock2.xml')

For example you could define a variable
<xsl:variable name="stock1" select="document('stock1.xml')" />

stock1 now contains the root node of the document in stock1.xml
It may be processed in any way you want, e.g.:
<xsl:apply-templates select="$stock1/stock/volume" />

If you just want a union (resp. a conglomerate) of both XML sources,
have a look at my merging tool at
http://www.informatik.hu-berlin.de/~obecker/XSLT/#merge

Cheers,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.