[Top] [All Lists]

[xsl] Recursively Merging 2 XML files with XSLT

2006-11-23 05:06:08
Hi there, I'm having a problem with merging a couple of XML files.
I've found a few examples of merging on-line but none that really

Basically I have an XML file which is written out by my Java program
that looks something like this:

  <data val="xx">
     <data val="yy">
        <data val="ss"></data>
  <data val="gg"></data>

The number of children and siblings can change by the way.

Therefore in the XSLT document I'm displaying the data recursively, i.e.

<tr><td><xsl:value-of select="@val"/></td></tr>
<xsl:for-each select="*">
  <xsl:call-template name="itself"></xsl:call-template>

This all works fine, but I now need to do a side by side comparison
with another XML document that has exactly the same structure, but
could have different values. I'm not sure how to do this, perhaps
using the same recursive code and using a sort of pointer to where you
are in the 2nd XML file (see below), but I've no idea how to go about

<tr><td><xsl:value-of select="@val"/></td>
      <td><xsl:value-of select="<2nd documents @val>"/></td>
<xsl:for-each select="*">
  <xsl:call-template name="itself"></xsl:call-template>


xx    xy
yy    yy
ss   ss
gg   hh

Does anybody have any suggestions or help on how to achieve this?


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>

<Prev in Thread] Current Thread [Next in Thread>