This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Trying to learn XSL
- To: "'XSL-List at mulberrytech dot com'" <XSL-List at mulberrytech dot com>
- Subject: Trying to learn XSL
- From: Tucker Williams <tucker at handango dot com>
- Date: Thu, 24 Feb 2000 18:04:39 -0600
- Reply-To: xsl-list at mulberrytech dot com
I'm trying to play around with some XSL. Someone else wrote this and I'm
trying to figure out how to change it to my liking. What I want to do is
for every other table cell after the table header have the colors of the
table cell change every other cell.
Here's what I have so far:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<html>
<head><title>Incidents Currently Logged at Handango.com</title></head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="/*">
<table border='2'>
<xsl:for-each select="*[position() = 1]/*">
<th bgcolor='GRAY'>
<xsl:value-of select="local-name()"/>
</th>
</xsl:for-each>
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="/*/*">
<tr>
<xsl:apply-templates/>
</tr>
</xsl:template>
<xsl:template match="/*/*/*">
<td bgcolor="slateblue">
<font color="wheat">
</font>
</td>
</xsl:template>
</xsl:stylesheet>
I'm wondering if I need a function to do this, something like:
<xsl:choose>
<xsl:when expr="[position() mod 2] =1">
some html
</xsl:when>
<xsl:when expr="[position() mod 2] =0">
some html
</xsl:when>
</xsl:choose>
Am I on the right track? Or have I derailed?
Any help is appreciated.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list