|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Every other row with a different twist
I'm sorry if this has already been discussed to death, I tried searching the list, but found nothing close enough. Like a lot of other people I'm trying to color every other table row. Normally I would do this with position() mod 2, but in this case that's not practical. My xml can be represented like this: <person>
<address>
<city/>
<tel/>
</address>
<employer>
<name/>
<tel/>
</employer>
</person>my stylesheet look like this: <xsl:template match="person"> <table> <xsl:if test="boolean(address/name)">
<tr>
<td>Person's home city:</td>
<td><xsl:value-of select="address/name"/></td>
</tr>
</xsl:if> <xsl:if test="boolean(employer/name)">
<tr>
<td>Person's employer:</td>
<td><xsl:value-of select="employer/name"/></td>
</tr>
</xsl:if> <xsl:if test="boolean(employer/tel)">
<tr>
<td>Employer's telephone number:</td>
<td><xsl:value-of select="employer/tel"/></td>
</tr>
</xsl:if></table> </xsl:template> Notice that the number of rows in the output will vary depending on the existence of the nodes in the input xml. Also note that I'm not using all the elements in the input. Lastly, the labels in the first td in each block are completely arbitrary. Now, of course the client would like to color every other row. I'm stumped, can't figure out a way to do it. Any help would be very much appreciated, I don't mind cheating, rewriting the above in any way or whatever, as long as it does not require changes to the html data (this is only one page, there are more). Of course, this might be impossible :-( I'm running XalanJ version 1.2.2 under Apache JServ. Thanks, Arni XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








