BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


XSLT
Re: Re: Creating a hyper link in XSL(T)
Re: Creating a hyper link in XSL(T)
Re: Creating a hyper link in XSL(T) - A slight variation
Creating a hyper link in XSL(T)
Creating a select box and selecting one or more items
Re: For Next Loop in XSLT
For Next Loop in XSLT
Intersection and other set operations on node-sets
Grouping using xsl:key and the key() function -- the Muenchian method
Comparing Strings in XSLT for greater/less
How to do a search and replace in XSLT
How to work with more than one xml document in your XSLT transformation
Sorting (advanced) of dynamically constructed strings
Sorting on Dates and other Fixed Formats using the substring Function
In case you need a ""break"" from an xsl:for-each loop
Format XML/XSL for Documentation
Find all xsl:variables that are in scope?
Binary Search in XSLT
Get the newest 5 articles out of hundreds -- a super efficient sort in XSLT
getTemplate


 
 

<< XQuery.NET and XML >>


By Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First Posted 12/03/2007
Times viewed 8959

Displaying every odd row a different color


This post contains attachments
v20010125232950.zip 

Summary To display the background color of every odd row in a table in a different color you need to use the XPath position() function. This achieved using the mod operator.

To our <td> element we are going to add the bgcolor element to be silver if the mod operator returns false (0), which is achieved in the following code:
<td>
<xsl:if test=position() mod 2>
<xsl:attribute name=bgcolor>silver</xsl:attribute>
</xsl:if>

The HTML output for this transformation looks as follows:

Today's Headlines
Rescued penguins swim home
Bug mops up sewage
In the land of the colour-blind

Additional information

Further additional information


Rate this article on a scale of 1 to 10 (5 votes, average 5)

Your vote :  

<< XQuery.NET and XML >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML