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