Subject: [xsl] two column table with alternating row colors using xsl xml and css From: nicholse@xxxxxxxxxxxxxxxx Date: Wed, 20 Aug 2003 01:03:28 -0700 (PDT) |
Well I finally got it! Thanks for everyones input. Here is the xsl: Eric <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpdsoresult" exclude-result-prefixes="fmp"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" /> <xsl:template match="fmp:FMPDSORESULT"> <style> .col1r0 { background-color: silver; color: black; width: 200;} .col1r1 { color: gray; width: 75;} .col2r0 { color: gray; width: 75;} .col2r1 { background-color: silver; color: black; width: 200;} </style> <table> <xsl:variable name="all_rows" select="fmp:ROW" /> <xsl:variable name="total" select="count($all_rows)" /> <xsl:for-each select="$all_rows[position() <= ceiling($total div 2)]"> <xsl:sort select="fmp:Co" /> <tr> <td class="col1r{position() mod 2}"> <b><xsl:value-of select="fmp:Co" /></b><br /> <xsl:value-of select="fmp:Address1" /><br /> <xsl:value-of select="fmp:City1" />, <xsl:value-of select="fmp:State1" />, <xsl:value-of select="fmp:Zip1" /> <br /> <a> <xsl:attribute name="href">javascript:var win = window.open("http://<xsl:value-of select="fmp:WebPage" />") </xsl:attribute> <xsl:value-of select="fmp:WebPage" /> </a> </td> <td class="col1r{position() mod 2}"> <xsl:choose> <xsl:when test="fmp:Phone1_Number"> (<xsl:value-of select="fmp:Phone1_Area_Code" />) <xsl:value-of select="fmp:Phone1_Number" /> <br /> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </td> <xsl:variable name="this_pos" select="position()" /> <xsl:variable name="next_item" select="$all_rows[$this_pos + floor($total div 2)]" /> <td class="col2r{position() mod 2}"> <xsl:choose> <xsl:when test="$next_item"> <b><xsl:value-of select="$next_item/fmp:Co" /></b><br /> <xsl:value-of select="$next_item/fmp:Address1" /><br /> <xsl:value-of select="$next_item/fmp:City1" />, <xsl:value-of select="$next_item/fmp:State1" />, <xsl:value-of select="$next_item/fmp:Zip1" /> <br /> <a> <xsl:attribute name="href">javascript:var win = window.open("http://<xsl:value-of select="$next_item/fmp:WebPage" />") </xsl:attribute> <xsl:value-of select="$next_item/fmp:WebPage" /> </a> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </td> <td class="col2r{position() mod 2}"> <xsl:choose> <xsl:when test="$next_item/fmp:Phone1_Number"> (<xsl:value-of select="$next_item/fmp:Phone1_Area_Code" />) <xsl:value-of select="$next_item/fmp:Phone1_Number" /> <br /> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Select drop down, better gene, Mattison | Thread | [xsl] default value in combobox, "Weber, Hans-Jürgen" |
Re: [xsl] MSXML3 transformNodeToObj, Joe Fawcett | Date | [xsl] default value in combobox, "Weber, Hans-Jürgen" |
Month |