The problem is exactly that i didn't know how to use templates.
I thought so.
It is <xsl:for-each select... not name ;-)
It was a Type error, but you are perfectly right: how can you
understand if i don't spell correctly words? : P
But I am afraid I still can't picture your problem. Can you post a
example snippet of your XML and XSL?
My Xml finally worked, elimininating this tag <xsl:for-each
select="NodeName">
and creating a template for this node. After i recall the template
from inside <body></body>. That was right?
Ok, so i thought "Now I Understood!". But I was still not right. I've
got another XML file, it's attached at the end of this post with his
xslt. I was trying to colour a cell only if the relative node is not
empty. In this case still doesn't work.
Dump your "easy" editor and use a more appropriate tool (Xselerator from
www.topxml.com has proven to be _very_ useful, if you work in a Windows
environment), or a plain text editor with XML syntax highlighting. At
least if you want to really learn it.
I surely want to learn this meta language, but like you know,
sometimes it happens you have to work on a tecnology, and then you
have the calm and the time to learn it. I used XMLSPy, with a
stylesheet designer. It seems to me to be very easy to use, but i
don'to know how to set choice upon two conditions, for example.
Here's the file, thanks a lot Martin for your help ^^
------------XML File----------------------------------------------
<!DOCTYPE Import SYSTEM "conti.dtd">
<?xml-stylesheet type="text/xsl" href="stileconti.xslt"?>
<Import>
<Row>
<Data_operazione> 07/10/2003 </Data_operazione>
<Data_valuta> 12/09/2003 </Data_valuta>
<Importo_debito></Importo_debito>
<Importo_credito>9,8</Importo_credito>
<Causale>CausaleText</Causale>
</Row>
<Row>
<Data_operazione> 08/10/2003 </Data_operazione>
<Data_valuta> 09/09/2003 </Data_valuta>
<Importo_debito>30</Importo_debito>
<Importo_credito> </Importo_credito>
<Causale>CausaleText</Causale>
</Row>
</Import>
--------end of XML File---------------------------------------------
------------xslt file----------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head/>
<body>
<xsl:for-each select="Import">
<xsl:apply-templates select="Row"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template match="Row">
<xsl:if test="position()=1">
<table border="1">
<thead>
<tr>
<td style="background-color:#004080">
<span style="color:white; font-family:Verdana; font-size:9;
font-weight:bold; text-transform:capitalize">Data operazione</span>
</td>
<td style="background-color:#004080">
<span style="color:white; font-family:Verdana; font-size:9;
font-weight:bold; text-transform:capitalize">Data valuta</span>
</td>
<td style="background-color:#004080">
<span style="color:white; font-family:Verdana; font-size:9;
font-weight:bold; text-transform:capitalize">Importo debito</span>
</td>
<td style="background-color:#004080">
<span style="color:white; font-family:Verdana; font-size:9;
font-weight:bold; text-transform:capitalize">Importo credito</span>
</td>
<td style="background-color:#004080">
<span style="color:white; font-family:Verdana; font-size:9;
font-weight:bold; text-transform:capitalize">Causale</span>
</td>
</tr>
</thead>
<tbody>
<xsl:for-each select="../Row">
<tr>
<td style="background-color:#C0C0C0">
<xsl:for-each select="Data_operazione">
<span style="font-family:Verdana; font-size:9">
<xsl:apply-templates/>
</span>
</xsl:for-each>
</td>
<td style="background-color:#D3D3D3">
<xsl:for-each select="Data_valuta">
<span style="font-family:Verdana; font-size:9">
<xsl:apply-templates/>
</span>
</xsl:for-each>
</td>
<td style="background-color:#D90000">
<xsl:for-each select="Importo_debito">
<!--------------------Here it is the "choose"--------------------->
<xsl:choose >
<xsl:when test="Importo_debito != '' ">mycode for coloured
cell</xsl:when>
</xsl:choose>
<!---------------------------------------------------------------->
<span style="color:white; font-family:Verdana;
font-size:9">
<xsl:apply-templates/>
</span>
<xsl:choose><xsl:when test="@Importo_debito != ''
"> </xsl:when></xsl:choose>
</xsl:for-each>
</td>
<td style="background-color:#008000">
<xsl:for-each select="Importo_credito">
<span style="color:#FFFFFF; font-family:Verdana;
font-size:9">
<xsl:apply-templates/>
</span>
</xsl:for-each>
</td>
<td>
<xsl:for-each select="Causale">
<span style="font-family:Verdana; font-size:9;
text-transform:lowercase">
<xsl:apply-templates/>
</span>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:if>
</xsl:template>
</xsl:stylesheet>