Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


merging two XML files

From: "Stefan Franke" <stefan.franke@---.--.-->
To: NULL
Date: 1/4/2005 7:07:00 PM
Hi,
I would like to merge two XML files. The first XML contains a list of books, 
the second XML file contains a bestseller list of books. So some of the 
books in the first file will appear in the second file.

I want to merge the two files, so that the ones, that also exist in the 
second XML file are printed in bold. I am trying to compare the titles of 
the books, but this doesn't seem to work.

Could anybody give me a hint how to solve this? I guess this XPath statement 
ind the <xsl:when...> is not quite right...

Thanks,
Stefan



<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:variable name="doc1" select="/" />
<xsl:variable name="doc2" select="document('Buchbestand.xml')" />

<xsl:template match="/">
      <xsl:for-each select="$doc2/BUCHBESTAND/BUCH">
      <xsl:choose>
       <xsl:when test="($doc1/BESTSELLER/EINTRAG/TITEL) = 
($doc2/BUCHBESTAND/BUCH/TITEL)">
        <b><xsl:value-of select="TITEL"/></b><br />
       </xsl:when>
       <xsl:otherwise>
        <xsl:value-of select="TITEL"/><br />
       </xsl:otherwise>
      </xsl:choose>
      </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

...................................................................

second XML file:

<?xml-stylesheet type="text/xsl" href="Bestseller.xsl"?>
<BESTSELLER>
 <EINTRAG>
  <TITEL>...</TITEL>
  <VERLAG>...</VERLAG>
  <JAHR>...</JAHR>
 </EINTRAG>
 <EINTRAG>
...
</BESTSELLER>

...................................................................

first XML file:

<BUCHBESTAND>
   <BUCH Einband="..." Lagernd="...">
      <TITEL>...</TITEL>
      <AUTOR>...</AUTOR>
      <SEITEN>...</SEITEN>
      <PREIS>...</PREIS>
   </BUCH>
...
</BUCHBESTAND> 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent