Subject: Re: [xsl] every tenth row change bgcolor From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 06 Jun 2003 07:50:18 -0400 |
1. The question is that why in the first group is only 9 rows?
2. In this part : (floor(position() div 20) mod 2), Am I saying something like modulate the group of 20 by 0 and 1 values? Quess not, but have to suggest something =)
T:\ftemp>type jarkko.xml <?xml version="1.0" encoding="UTF-8"?> <Report>
<Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <!-- 10 -->
<Row>blue</Row> <Row>blue</Row> <Row>blue</Row> <Row>blue</Row> <Row>blue</Row> <Row>blue</Row> <Row>blue</Row> <Row>blue</Row> <Row>blue</Row> <Row>blue</Row> <!-- 20 -->
<Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <Row>white</Row> <!-- 30 -->
T:\ftemp>type jarkko.xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <!-- Root template of my stylesheet --> <xsl:template match="/"> <html> <head> <title>Color rows</title> <style type="text/css"> .r0 {background-color: white} .r1 {background-color: blue} </style> </head> <body> <table border="1"> <xsl:apply-templates select="Report/Row"/> </table> </body> </html> </xsl:template>
<xsl:template match="Row"> <tr class="r{floor((position() - 1) div 10) mod 2}"> <xsl:apply-templates/> </tr> </xsl:template>
T:\ftemp>type jarkko.htm <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Color rows</title><style type="text/css"> .r0 {background-color: white} .r1 {background-color: blue} </style></head> <body> <table border="1"> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r1">blue</tr> <tr class="r1">blue</tr> <tr class="r1">blue</tr> <tr class="r1">blue</tr> <tr class="r1">blue</tr> <tr class="r1">blue</tr> <tr class="r1">blue</tr> <tr class="r1">blue</tr> <tr class="r1">blue</tr> <tr class="r1">blue</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> <tr class="r0">white</tr> </table> </body> </html> T:\ftemp>rem Done!
-- Upcoming hands-on courses: (registration still open!) - (XSLT/XPath and/or XSL-FO) North America: June 16-20, 2003
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-11-X Practical Formatting Using XSL-FO Member of the XML Guild of Practitioners: http://XMLGuild.info Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] every tenth row change bgcolo, Jarkko Moilanen | Thread | Re: [xsl] every tenth row change bg, Jarkko Moilanen |
[xsl] xsl:param, James Cummings | Date | [xsl] MIME Digest?, Arnaud Vandyck |
Month |