Jump to content

xsl and filter by year


Guest LALIFA

Recommended Posts

Help please!!!!I have a big big problems with an xsl stylesheet.My xml file is:

<registro_prenotazioni>	<prenotazione_privati>  <cognome>Rossi</cognome>  <nome>Mario</nome>  <nota>arriva dopo le ore 18</nota>  <nazionalita>Italiana</nazionalita>  <indirizzo>Via Trento</indirizzo>  <civico>15</civico>  <cap>38023</cap>  <citta>Cles</citta>  <provincia>(Tn)</provincia>  <telefono>0463432568</telefono>  <tesserato>si</tesserato>  <consenso>si</consenso>  <e_mail>rossi@hotmail.com</e_mail>  <data_prenotazione> 	 <giorno_p>12</giorno_p> 	 <mese_p>07</mese_p> 	 <anno_p>2005</anno_p>  </data_prenotazione>  <data_arrivo> 	 <giorno_a>17</giorno_a> 	 <mese_a>07</mese_a> 	 <anno_a>2005</anno_a>  </data_arrivo>  <provenienza>Rifugio Pedrotti</provenienza>  <motivo>Escursionismo</motivo>  <numero_persone>2</numero_persone>  <numero_notti>1</numero_notti>  <numero_stanza>1</numero_stanza>	</prenotazione_privati>	<prenotazione_gruppi>  <nome_gruppo>Summit</nome_gruppo>  <nota>arriva dopo le ore 18</nota>  <nazionalita>Tedesca</nazionalita>  <indirizzo>Via Trento</indirizzo>  <civico>15</civico>  <cap>36783</cap>  <citta>Innsbruck</citta>  <provincia>(Tn)</provincia>  <telefono>0463432568</telefono>  <e_mail>summit@hotmail.com</e_mail>  <data_prenotazione> 	 <giorno_p>12</giorno_p> 	 <mese_p>07</mese_p> 	 <anno_p>2005</anno_p>  </data_prenotazione>  <data_arrivo> 	 <giorno_a>17</giorno_a> 	 <mese_a>07</mese_a> 	 <anno_a>2005</anno_a>  </data_arrivo>  <provenienza>Rifugio Pedrotti</provenienza>  <motivo>Ferrate</motivo>  <numero_persone>8</numero_persone>  <numero_notti>2</numero_notti>  <stanze> 	 <prima_stanza>    <numero_prima_stanza>8</numero_prima_stanza>    <pp_prima_stanza>3</pp_prima_stanza> 	 </prima_stanza> 	 <seconda_stanza>    <numero_seconda_stanza>2</numero_seconda_stanza>    <pp_seconda_stanza>4</pp_seconda_stanza> 	 </seconda_stanza> 	 <terza_stanza>    <numero_terza_stanza>camerone</numero_terza_stanza>    <pp_terza_stanza>1</pp_terza_stanza> 	 </terza_stanza> 	 <quarta_stanza>    <numero_quarta_stanza/>    <pp_quarta_stanza/> 	 </quarta_stanza> 	 <quinta_stanza>    <numero_quinta_stanza/>    <pp_quinta_stanza/> 	 </quinta_stanza>  </stanze>	</prenotazione_gruppi>	<prenotazione_gruppi>  <nome_gruppo>Oase</nome_gruppo>  <nota>6+1</nota>  <nazionalita>Tedesca</nazionalita>  <indirizzo>Josef Platz</indirizzo>  <civico>195</civico>  <cap>78433</cap>  <citta>Monaco</citta>  <provincia/>  <telefono>09849728</telefono>  <e_mail>oase@hotmail.com</e_mail>  <data_prenotazione> 	 <giorno_p>12</giorno_p> 	 <mese_p>08</mese_p> 	 <anno_p>2005</anno_p>  </data_prenotazione>  <data_arrivo> 	 <giorno_a>03</giorno_a> 	 <mese_a>09</mese_a> 	 <anno_a>2005</anno_a>  </data_arrivo>  <provenienza>Rifugio Alimonta</provenienza>  <motivo>Ferrate</motivo>  <numero_persone>7</numero_persone>  <numero_notti>2</numero_notti>  <stanze> 	 <prima_stanza>    <numero_prima_stanza>8</numero_prima_stanza>    <pp_prima_stanza>3</pp_prima_stanza> 	 </prima_stanza> 	 <seconda_stanza>    <numero_seconda_stanza>10</numero_seconda_stanza>    <pp_seconda_stanza>1</pp_seconda_stanza> 	 </seconda_stanza> 	 <terza_stanza>    <numero_terza_stanza>9</numero_terza_stanza>    <pp_terza_stanza>3</pp_terza_stanza> 	 </terza_stanza> 	 <quarta_stanza>    <numero_quarta_stanza/>    <pp_quarta_stanza/> 	 </quarta_stanza> 	 <quinta_stanza>    <numero_quinta_stanza/>    <pp_quinta_stanza/> 	 </quinta_stanza>  </stanze>	</prenotazione_gruppi></registro_prenotazioni>ecc.

I need to obtain an xsl that shows in output only the reservation (prenotazioni) which have '2005' as year of arrival (data_arrivo/anno_a).I have made thousand of tring but it seems not to understand what 2005 is!!If I use, for example, the telephone number, it works!!!!please help!! :):) my xsl is:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"><xsl:template match="/"><html>	<head>  <title>Prenotazioni</title>	</head>	<body><center><h1>Lista prenotazioni</h1></center>		<table  border="2" cellpadding="0" cellspacing="2">  <tbody> 	 <tr>    <th>ID</th><th>Data prenot.</th><th>Soggetto<br>gruppo</br></th><th>Nazion.</th><th>Indirizzo</th><th>Telefono</th><th>UIAA</th>    <th>E-mail</th><th>Data di arrivo</th><th>Provenienza</th><th>PP</th><th>Notti</th><th>Stanza Nr. (PP)</th><th>Nota</th> 	 </tr> 	     <xsl:apply-templates select="registro_prenotazioni/prenotazione_privati"/> 	 <xsl:apply-templates select="registro_prenotazioni/prenotazione_gruppi"/>  </tbody>	</table>		</body></html></xsl:template><xsl:template match="registro_prenotazioni/prenotazione_privati"><tr><td align="center"><xsl:number value="position()"/></td><td><xsl:value-of select="./data_prenotazione/giorno_p"/><xsl:text>-</xsl:text><xsl:value-of select="./data_prenotazione/mese_p"/><xsl:text>-</xsl:text><xsl:value-of select="./data_prenotazione/anno_p"/></td><td><b><xsl:value-of select="./cognome"/><br></br><xsl:value-of select="./nome"/></b></td><td><xsl:value-of select="./nazionalita"/></td><td><xsl:value-of select="./indirizzo"/><xsl:text> </xsl:text><xsl:value-of select="./civico"/><xsl:text>, </xsl:text><br></br><xsl:value-of select="./cap"/><xsl:text> </xsl:text><xsl:value-of select="./citta"/><xsl:text> </xsl:text><xsl:value-of select="./provincia"/></td><td><xsl:value-of select="./telefono"/></td><td align="center"><xsl:value-of select="./tesserato"/></td><td><xsl:value-of select="./e_mail"/></td><td><xsl:value-of select="./data_arrivo/giorno_a"/><xsl:text>-</xsl:text><xsl:value-of select="./data_arrivo/mese_a"/><xsl:text>-</xsl:text><xsl:value-of select="./data_arrivo/anno_a"/></td><td><xsl:value-of select="./provenienza"/></td><td align="center"><xsl:value-of select="./numero_persone"/></td><td align="center"><xsl:value-of select="./numero_notti"/></td><td align="center"><xsl:value-of select="./numero_stanza"/><xsl:text> (</xsl:text><xsl:value-of select="./numero_persone"/><xsl:text>)</xsl:text></td><td><xsl:value-of select="./nota"/></td><td><a href="logineliminaprenotazione.html"><img  title="elimina prenotazione" border="0" src="cestino.gif"/></a><xsl:text>  </xsl:text><a href="loginprenotazionimod.html"><img title="modifica prenotazione" border="0" src="appunti.gif"/></a></td></tr></xsl:template><xsl:template match="registro_prenotazioni/prenotazione_gruppi"><tr bgcolor="lightskyblue"><td align="center"><xsl:number value="position()"/></td><td><xsl:value-of select="./data_prenotazione/giorno_p"/><xsl:text>-</xsl:text><xsl:value-of select="./data_prenotazione/mese_p"/><xsl:text>-</xsl:text><xsl:value-of select="./data_prenotazione/anno_p"/></td><td><b><xsl:value-of select="./nome_gruppo"/></b></td><td><xsl:value-of select="./nazionalita"/></td><td><xsl:value-of select="./indirizzo"/><xsl:text> </xsl:text><xsl:value-of select="./civico"/><xsl:text>, </xsl:text><br></br><xsl:value-of select="./cap"/><xsl:text> </xsl:text><xsl:value-of select="./citta"/><xsl:text> </xsl:text><xsl:value-of select="./provincia"/></td><td><xsl:value-of select="./telefono"/></td><td></td><td><xsl:value-of select="./e_mail"/></td><td><xsl:value-of select="./data_arrivo/giorno_a"/><xsl:text>-</xsl:text><xsl:value-of select="./data_arrivo/mese_a"/><xsl:text>-</xsl:text><xsl:value-of select="./data_arrivo/anno_a"/></td><td><xsl:value-of select="./provenienza"/></td><td align="center"><xsl:value-of select="./numero_persone"/></td><td align="center"><xsl:value-of select="./numero_notti"/></td><td align="center"><xsl:value-of select="./stanze/prima_stanza/numero_prima_stanza"/><xsl:text> (</xsl:text><xsl:value-of select="./stanze/prima_stanza/pp_prima_stanza"/><xsl:text>); </xsl:text><xsl:value-of select="./stanze/seconda_stanza/numero_seconda_stanza"/><xsl:text> (</xsl:text><xsl:value-of select="./stanze/seconda_stanza/pp_seconda_stanza"/><xsl:text>); </xsl:text><xsl:value-of select="./stanze/terza_stanza/numero_terza_stanza"/><xsl:text> (</xsl:text><xsl:value-of select="./stanze/terza_stanza/pp_terza_stanza"/><xsl:text>); </xsl:text><xsl:value-of select="./stanze/quarta_stanza/numero_quarta_stanza"/><xsl:text> (</xsl:text><xsl:value-of select="./stanze/quarta_stanza/pp_quarta_stanza"/><xsl:text>); </xsl:text><xsl:value-of select="./stanze/quinta_stanza/numero_quinta_stanza"/><xsl:text> (</xsl:text><xsl:value-of select="./stanze/quinta_stanza/pp_quinta_stanza"/><xsl:text>); </xsl:text></td><td><xsl:value-of select="./nota"/></td><td><a href="logineliminaprenotazione.html"><img  title="elimina prenotazione" border="0" src="cestino.gif"/></a><xsl:text>  </xsl:text><a href="loginprenotazionimod.html"><img title="modifica prenotazione" border="0" src="appunti.gif"/></a></td></tr></xsl:template></xsl:stylesheet>

Thanks to everybody who'll help me!!laura

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...