S
Stefan Franke
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>
<xsltherwise>
<xsl:value-of select="TITEL"/><br />
</xsltherwise>
</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>
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>
<xsltherwise>
<xsl:value-of select="TITEL"/><br />
</xsltherwise>
</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>