|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: From 2 original xmls to 1.
> 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
|
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








