Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 16th, 2009, 02:54 AM
Registered User
 
Join Date: Jul 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question HELP: Alternating Color Question

<xsl:for-each select="row">
<xsl:variable name="row_gvalue" select="col[1]/LabelItem/value"/>
<xsl:variable name="pos" select="position()-1"/>
<xsl:variable name="prow_gvalue" select="../row[$pos]/col[1]/LabelItem/value"/>
<xsl:variable name="create_header" select="$row_gvalue != $prow_gvalue or string-length($prow_gvalue) = 0 and position() > 1 " />
<xsl:variable name="row_index" select="position()"/>
<xsl:if test = "$create_header">
<xsl:variable name="backgroundColor">
... this part is my problem, I want to get the current number of the created header [and will be used as a basis for alternate color]
<xsl:value-of select="$color_alt_light"/>
</xsl:variable>

<tr bgcolor="gray" >
<td colspan="20" height="1"></td>
</tr>
<tr bgcolor="{$backgroundColor}" id="tr_{$row_gvalue}">
<td width="20" height="20" align="center">
&amp;nbsp;<img id="img_{$row_gvalue}" src="img/plus.gif" style="cursor:hand" onclick="displayChildNodes('{$row_gvalue}')" />&amp;nbsp;
</td>
<td colspan="20" class="txt11BoldBlue" style="cursor:hand" onclick="displayChildNodes('{$row_gvalue}')">
<xsl:value-of select="$row_gvalue"/>
</td>
</tr>
</xsl:if>
<tr id="child_{$row_gvalue}" bgcolor="gray" style="display:none" >
<td colspan="20" height="1"></td>
</tr>
<tr id="child_{$row_gvalue}" name="child_{$row_gvalue}" style="display:none" bgcolor="{$color_child_items}">
<td>&amp;nbsp;</td>
<xsl:for-each select="col">
<td align="{@align}" width="{@width}" class="{@css}">
<xsl:apply-templates select="LabelItem"/>
<xsl:apply-templates select="Link"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
 
Old July 16th, 2009, 06:20 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Thumbs up

To start with, it would be helpful if you post some part of relevant input xml file.
__________________
Rummy





Similar Threads
Thread Thread Starter Forum Replies Last Post
Alternating colors in table crabjoe Classic ASP Basics 3 March 12th, 2007 09:28 AM
Alternating Colors in ListBox rows nkrust ASP.NET 1.0 and 1.1 Basics 2 January 10th, 2007 03:27 PM
Alternating Colors in ListBox rows nkrust ASP.NET 1.0 and 1.1 Professional 1 January 10th, 2007 09:47 AM
create <ul> with alternating class on <li> element Brian Campbell XSLT 2 November 3rd, 2006 06:07 PM
alternating colours ozPATT Excel VBA 3 October 5th, 2005 10:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.