xsl-list
[Top] [All Lists]

Re: [xsl] Merge 2 xmls : Loop through one xml and get elements from second xml

2020-09-01 08:32:11
you can use,

 <xsl:variable name="docs" select="*for* *$f* *in* (*$first_xml*,
*$second_xml*) *return* *document*(*$f*)" as="document-node()*"/>

or you can create a XML pipeline using ant scripts, where you merge the two
XML files then process it to create the 3rd XML file.

On Tue, Sep 1, 2020 at 6:18 PM Martin Honnen 
martin(_dot_)honnen(_at_)gmx(_dot_)de <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Am 01.09.2020 um 14:41 schrieb Prady Prady 
prady(_dot_)chin(_at_)gmail(_dot_)com:

But I need to use only XSLT 1.0

Declare

<xsl:param name="doc2" select="document('Orders_Part2.xml')"/>

and a key

<xsl:key name="order" match="order" use="order_number"/>

then use

<xsl:template match="order">
   <xsl:copy>
     <xsl:apply-templates select="@* | node()"/>
     <xsl:variable name="ordernumber" select="order_number"/>
     <xsl:for-each select="$doc2">
       <xsl:apply-templates select="key('order', $ordernumber)/amount"/>
     </xsl:for-each>
   </xsl:copy>
</xsl:template>

plus the identity transformation

<xsl:template match="@* | node()">
   <xsl:copy>
     <xsl:apply-templates select="@* | node()"/>
   </xsl:copy>
</xsl:template>



    =================
    Merge 2 xmls : Loop through one xml and get elements from second
xml

    I have 2 xmls(Orders_Part1.xml,Orders_Part2.xml). I have to build
the
    3rd xml ( Orders.xml) .



--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>