<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <!-- Modello per la radice del documento -->
  <xsl:template match="/">
    <html>
      <head>
        <title>Pagina delle notizie</title>
        <!-- Chiamata ad un documento CSS esterno -->
        <link rel="stylesheet" type="text/css" href="notizie-formattazione.css"/>
      </head>
      <body>
         <p>Ultime notizie</p>
         <xsl:apply-templates select="notizie/notizia">
              <xsl:sort select="data" order="descending"/>
         </xsl:apply-templates>
      </body>
    </html>
  </xsl:template>
  
  <!-- Modello da applicare per ogni notizia -->
  <xsl:template match="notizie/notizia">
    <div>
         <strong><xsl:value-of select="titolo"/></strong><br/>
         <xsl:value-of select="testo"/><br/>
         <xsl:value-of select="data"/><br/>
         <a target="_blank">
            <xsl:attribute name="href">
                   http://<xsl:value-of select="collegamento"/>
            </xsl:attribute>
            <xsl:value-of select="collegamento"/>
         </a>
    </div>
  </xsl:template>
  
</xsl:stylesheet>

