[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Tracking line counts uniquely by section

Subject: Tracking line counts uniquely by section
From: "Schwartz, Rechell R, ALCAS" <rrschwartz@xxxxxxx>
Date: Thu, 7 Nov 2002 16:00:31 -0500
line tracking
All,

I am using the following code (adapted from code graciously provided by Ken Holman) to generate alternate row colors for rows in a table using the identity transformation. I would now like to take the next step and add the following change:

The table is comprised of multiple sections and after each section header, I want to be able able to start the row counter back to 1 so that the line following the section header always has the same color: The distingushing characteristics of the section headers are that they have a class attribute called "headerStyle", and therefore need to be exempted form receiving
an odd or even row style, and rows following the section header line all need to have the same color.

I was trying to get it to work by using paramters and recursion but got stuck. Any assistance would be greatly appreciated.

Thanks,
Rechell

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="1.0">
<xsl:output method="html" indent="yes"/>

<xsl:template match="node()|@*"> <!--identity transform-->
   <xsl:copy>
     <xsl:apply-templates select="node()|@*"/>
   </xsl:copy>
</xsl:template>

<xsl:template match="tr[ position() mod 2 = 0 ]/td">
   <xsl:copy>
    <xsl:attribute name="class">oddRowStyle</xsl:attribute>
     <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
</xsl:template>

<xsl:template match="tr[ position() mod 2 = 1 ]/td">
   <xsl:copy>
    <xsl:attribute name="class">evenRowStyle</xsl:attribute>
     <xsl:apply-templates select="node()|@*"/>
   </xsl:copy>
</xsl:template>

</xsl:stylesheet>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.