|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: union elements in multiple xml documents
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








