Hi everybody!
this is my first post here but I would like to start saying thank you 'cos even if I never wrote here I read so many useful posts!
Here is the issue coming...
I need to generate an html table for a prods catalogue starting from xml.
So, it has been easy to get the data I need but it seems to be not that easy to style it up!
I'll let the code speak for me now...
[code=txt]
<table>
<xsl:for-each select="Fields/field">
<xsl:if test="not(conta ins(pName, 'blabla') or pValue = '' or @hiddenField='t rue')">
<tr>
<td class="label">
<xsl:text> • </xsl:text>
<xsl:value-of select="pName"/>
</td>
<td class="value">
<xsl:value-of select="pValue"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
[/code]
so the DREAM is to have something like a counter to find out if a row is odd or even and then to give it a class (like tr class=evenrow ..)
Of course the first idea I had was to check the value of position() of a node but since I dont get all the nodes (because of the if condition) the value i get it's useless...
Does anybody know some trick or just some easy solution for this?
I know it probably can be a really stupid question for you but I'm a newbie with xsl and xpath...I'm founding it really exciting and in few days i learnt a lot but...not enough to solve this :)
thanks in advance for any help!
Ale
this is my first post here but I would like to start saying thank you 'cos even if I never wrote here I read so many useful posts!
Here is the issue coming...
I need to generate an html table for a prods catalogue starting from xml.
So, it has been easy to get the data I need but it seems to be not that easy to style it up!
I'll let the code speak for me now...
[code=txt]
<table>
<xsl:for-each select="Fields/field">
<xsl:if test="not(conta ins(pName, 'blabla') or pValue = '' or @hiddenField='t rue')">
<tr>
<td class="label">
<xsl:text> • </xsl:text>
<xsl:value-of select="pName"/>
</td>
<td class="value">
<xsl:value-of select="pValue"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
[/code]
so the DREAM is to have something like a counter to find out if a row is odd or even and then to give it a class (like tr class=evenrow ..)
Of course the first idea I had was to check the value of position() of a node but since I dont get all the nodes (because of the if condition) the value i get it's useless...
Does anybody know some trick or just some easy solution for this?
I know it probably can be a really stupid question for you but I'm a newbie with xsl and xpath...I'm founding it really exciting and in few days i learnt a lot but...not enough to solve this :)
thanks in advance for any help!
Ale
Comment