You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Victor Smirnov <vi...@uwc.ru> on 2000/03/28 08:25:40 UTC
Colored table :)
Hello all!
May be this can be usefull for someone:)
With this xsl instruction one can color every even row in a table with light
grey:
<xsl:template match="blk_item[position() div 2 != floor(position() div 2)]">
<tr bgcolor="#EFEFEF">
<td>
<xsl:apply-templates select="blk"/>
</td>
<td align="right">
<strong>
<xsl:apply-templates select="cnt"/>
</strong>
</td>
</tr>
</xsl:template>
<xsl:template match="blk_item[position() div 2 = floor(position() div 2)]">
<tr>
<td>
<xsl:apply-templates select="blk"/>
</td>
<td align="right">
<strong>
<xsl:apply-templates select="cnt"/>
</strong>
</td>
</tr>
</xsl:template>
It asumes the following xml
<blk_item>
<blk>abc</blk>
<cnt>1</cnt>
</blk_item>
<blk_item>
<blk>def</blk>
<cnt>2</cnt>
</blk_item>
...
- Victor
Re: Colored table :)
Posted by Sean Kelly <ke...@mail2a.jpl.nasa.gov>.
> <xsl:template match="blk_item[position() div 2 != floor(position() div
2)]">
Nice trick. On Xalan 1.0.0, the following also works:
<xsl:template match="blk_item[position() mod 2 = 0]">
Whether "mod" is a Xalan extension or a legal XPath expression ... I don't
know.
Take care.
--Sean