I am trying to merge multiple dom documents.

I tryed this way:
         - create a third dom document
         - then using getChildNodes(); retrieve nodes for the first and for 
the second
         - then using    createElement  and appendChild
and I have been able to build the dom whose content is the merge of the 2 
documents.

Don't like this way .. so I am trying using XSL stylesheet .

Then:
- I transform the first DOM document using this stylesheet IDENTITY.XSL
and writing the result in the file TEMP.XSL
******************************************************************************
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<!--xsl:output method = "xml" indent = "yes" /-->
<xsl:template match = "ROWSET" >
      <xsl:copy >
           <xsl:apply-templates />
      </xsl:copy>
</xsl:template>
<xsl:template match = "node()" >
      <xsl:copy >
           <xsl:apply-templates select = "node()" />
      </xsl:copy>
</xsl:template>
******************************************************************************

- I transform again using the first DOM document using this stylesheet 
MERGED.XSL
and writing the result in the file OUTPUT.XML

******************************************************************************
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:import href = "temp.xsl" />

<xsl:template match = "ROWSET" >
      <xsl:copy >
           <xsl:apply-templates />
      </xsl:copy>
</xsl:template>

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


</xsl:stylesheet>
******************************************************************************

But the resulting file is missing the information from the first file.

Really, the TEMP.XSL file contains
<ROWSET>
         <ROW>
                 <codice>01</codice>
                 <nome_filiale>FI01</nome_filiale>
                 <nome_filiale_esteso>SDB Firenze</nome_filiale_esteso>
         </ROW>
</ROWSET>

While the OUTPUT.XML file contains
<ROWSET>
         <ROW>
                 <codice>02</codice>
                 <nome_filiale>SC02</nome_filiale>
                 <nome_filiale_esteso>SDB Roma</nome_filiale_esteso>
         </ROW>
</ROWSET>



I wanna it to contain something like this

<ROWSET>
         <ROW>
                 <codice>01</codice>
                 <nome_filiale>FI01</nome_filiale>
                 <nome_filiale_esteso>SDB Firenze</nome_filiale_esteso>
         </ROW>
         <ROW>
                 <codice>02</codice>
                 <nome_filiale>SC02</nome_filiale>
                 <nome_filiale_esteso>SDB Roma</nome_filiale_esteso>
         </ROW>
</ROWSET>


What am I missing?

Thks
Leonardo

Reply via email to