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

Re: From 2 original xmls to 1.

Subject: Re: From 2 original xmls to 1.
From: "Raffaele Sena" <raff@xxxxxxxxxxxx>
Date: Thu, 12 Dec 2002 18:10:54 -0800
url variables xmls
> Hi again,
> can someone tell me if there is possible to merge 2 xml files?
> I need to insert some tags from "B xml file" and others from "A xml file" in
> a resulting "xml final file"
> It's possible?
> 
    You pass one file (A.xml) as the input XML document
    and read the other (in a variable ?) with a "document('B.xml')".

    Or, if you want to be fancy, you create a third file
    that simple contains the first 2:

    <merge>
        <source href="A.xml"/>
        <source href="B.xml"/>
    </merge>

    Use this third file as your input XML document
    and read both original inputs (that you get by querying
    your "configuration" file with a document() function.
    In this way you can apply the same metodology to both document:

    <xsl:template match="/merge">
        <xsl:variable name="source-A" select="document(source[1]/@href"/>
        <xsl:variable name="source-B" select="document(source[2]/@href"/>

        <output>
            <tag-from-A>
                <xsl:value-of select="$source-A/some-tag-from-A"/>
            </tag-from-A>

            <tag-from-B>
                <xsl:value-of select="$source-B/some-tag-from-B"/>
            </tag-from-B>
        </output>
    </xsl:template>

    (I just typed this in, so it may contain errors and stuff).

Hope this helps,

    Raffaele

----------------------------------------------------------------
raff@xxxxxxxxxxxx       (::)       http://www.aromatic.org/~raff
              http://www.aromatic.org/

When I say artist I mean the man who is building things
 -- creating molding the earth -- whether it be the plains of the west
 -- or the iron ore of Penn. It's all a big game of construction
 -- some with a brush -- some with a shovel -- some choose a pen.

                             Jackson Pollock

 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.