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

RE: Alternate coloured Row Issue

Subject: RE: Alternate coloured Row Issue
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Wed, 13 Jun 2001 12:23:06 +0100
odd row xslt
Come on Tanzila,
You have been on this list long enough to answer that one yourself.
As a hint. Remove <xsl:template match="product[position() mod 2 = 1]">
template.
Change this one to
<xsl:template match="product">
       <tr>
		<xsl:attribute name="class"><xsl:if
test="count(preceding-sibling::product) mod 2">even etc

then add
<xsl:if test="position()=last()">
	<tr>
		<xsl:attribute.....
		<td>last bits

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


>-----Original Message-----
>From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Tanzila
>Mohammad
>Sent: 13 June 2001 11:37
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject:  Alternate coloured Row Issue
>
>
>My xml is as follows:
>
><products>
>               <product>
>                 <productID>1</productID>
>                 <name>Motorcyle</name>
>                 </product>
>                 <product>
>                 <productID>2</productID>
>                 <name>Accessories</name>
>                 </product>
>                  ..........
></products>
>
>My xsl allows for the products to be displayed on alternate coloured lines:
>
><xsl:template match="product[position() mod 2 = 1]">
>        <tr class="odd">
>                 <td>
>
>                 <div align="center">
>			<a> <xsl:attribute
>name="href">product.jsp?productID=<xsl:value-of
>select="productID"/>&amp;secondhtml=<xsl:value-of select="$secondhtml"/>
>           </xsl:attribute>
>             <b> <font face="Verdana, Arial, Helvetica, sans-serif">
>
>                <xsl:value-of select="name"/>
>               </font>   </b>
>             </a>
>             </div>
>             </td>
>            </tr>
>  </xsl:template>
>
><xsl:template match="product">
>       <tr class="even">
>                 <td>
>                 <div align="center">
>			<a> <xsl:attribute
>name="href">product.jsp?productID=<xsl:value-of
>select="productID"/>&amp;secondhtml=<xsl:value-of select="$secondhtml"/>
>           </xsl:attribute>
>             <b> <font face="Verdana, Arial, Helvetica, sans-serif">
>
>                <xsl:value-of select="name"/>
>               </font>   </b>
>             </a>
>             </div>
>            </td>
>            </tr>
>  </xsl:template>
>
>My problem relates to incorporating an independent last row, and making it
>follow the same colour pattern:
><tr>
>          <td>
>            <div align="center">
>              <a>
>		  <xsl:attribute name="href"><xsl:value-of
>select="$email"/></xsl:attribute>
>		  <b><font size="3" face="Verdana, Arial,
>Helvetica, sans-serif">Contact
>              Us</font></b>
>	      </a>
>
>           </div>
>          </td>
> </tr>
>
>E.G
>if odd=red and even=blue
>
>if there were 4 products you would expect:
>        row 1 (red) Motorcyles
>        row 2 (blue) Accessories
>        row 3 (red) Clothing
>        row 4 (blue) Cars
>       row 5 (red) Contact Us <!-- here is the problem-->
>
>if there were 3 products then you would expect:
>       row 1 (red) Motorcyles
>        row 2 (blue) Accessories
>        row 3 (red) Clothing
>        row 4 (blue) Contact Us <!-- here is the problem-->
>
>Thanks.
>
>Tanz
>
>
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 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.