Thank you in advance for your help. I'm new with XSLT. I'm trying to create a table where I can show:
- on the first column the values of the attribute "name" of
<schedaDescrittiva name="0001">.
- on the second column the values of the attribute "name" of
<div type="Fascicolo" name="0001">
- on the third column a comparison between the two values, highlighting with a color the cells where the two values don't match.
I tried different ways, but my efforts has been vain.
Here my XML (or, a part of it):
<xml>
<schedeDescrittive>
<schedaDescrittiva name="0001">
<titolo>(La) Distribuzione della proprietà fondiaria in Dogliani</titolo>
<descrizione>«Gazzetta di Dogliani» (Dogliani), a. 4, n. 199</descrizione>
</schedaDescrittiva>
<schedaDescrittiva name="0002">
<titolo>Epistolario di studenti</titolo>
<descrizione>«Crit. soc.», III, n. 13</descrizione>
</schedaDescrittiva>
</schedeDescrittive>
<livelliGerarchici>
<div type="Fondo" name="EL">
<div type="Serie" name="SEZ.1">
<div type="Sotto-serie" name="OIB">
<div type="Livello" name="1893">
<div type="Fascicolo" name="0001">
<div type="Copertina" ID="000008" link="./TIFF/EL_SEZ.1_OIB_000008_1893_2_01_0001.tif"/>
</div>
<div type="Fascicolo" name="0002">
<div type="Copertina" ID="000008" link="./TIFF/EL_SEZ.1_OIB_000008_1893_2_01_0002.tif"/>
</div>
</livelliGerarchici>
</xml>
Here what I have been trying to do until now:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<style>table, th, td {border: 1px solid black;}</style>
<tr>
<th>Confronto Valori</th>
</tr>
</head>
<body>
<table>
<tr>
<th>Valori Scheda Bibliografica</th>
<th>Valori Percorsi Cartelle</th>
<th>Comparazione</th>
</tr>
<xsl:for-each select="xml/schedeDescrittive/schedaDescrittiva">
<tr>
<td>
<xsl:value-of select="@name"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
<xsl:for-each select="xml/livelliGerarchici/div/div/div/div/div">
<tr>
<td>
<xsl:value-of select="@name"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
My first problem is that the value of the attribute name:
<div type="Fascicolo" name="0001">
appears on the first column and not in the second column as I would like to be. The second problem is to compare the two values that are on the same row. For that I've no idea.
I would really appreciate any suggestion. Thank you, Ivan