Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 63905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:42:23+00:00 2026-05-10T18:42:23+00:00

I would like to create an HTML table with row colors changing based on

  • 0

I would like to create an HTML table with row colors changing based on position and content. But instead of alternating every row, I’d like to be able to group rows together, so that I can have some XML like this:

<itemlist>    <item group='0'>Conent...blah blah</item>    <item group='0'>Content...who cares</item>    <item group='1'>Content</item>    <item group='2'>Content</item>    <item group='2'>Content</item> </itemlist> 

And all of the items with group=0 are one color, and items with group=1 are another, and group=2 are either toggled back to the first color, or are their own color.

All I can seem to find out there is ways to alternate every row, but I can’t seem to ‘get it’ when it comes to actually using the node data to help me make the decision.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:42:23+00:00Added an answer on May 10, 2026 at 6:42 pm

    Here’s an example of using ‘choose’ to apply a different class value based on the group value. Something similar to this would work if you want to treat each group in a specific way. If your decision logic for handling group 2 is more complex, then you could place additional decision logic inside the ‘when’ statement testing for group 2.

    <xsl:template match='/'>     <ul>         <xsl:apply-templates select='itemlist/item'/>     </ul> </xsl:template>  <xsl:template match='item'>     <li>         <xsl:attribute name='class'>             <xsl:choose>                 <xsl:when test='@group = 0'>                     red                 </xsl:when>                 <xsl:when test='@group = 1'>                     green                 </xsl:when>                 <xsl:when test='@group = 2'>                     blue                 </xsl:when>                 <xsl:otherwise>                     black                 </xsl:otherwise>             </xsl:choose>         </xsl:attribute>         <xsl:value-of select='.'/>     </li> </xsl:template> 

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 152k
  • Answers 152k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I believe the answer from Mike Dunlavey is the closest… May 12, 2026 at 10:09 am
  • Editorial Team
    Editorial Team added an answer Actually I found the problem. The event handler was inside… May 12, 2026 at 10:09 am
  • Editorial Team
    Editorial Team added an answer Check out SIM Application Toolkit. Check this simlar question too… May 12, 2026 at 10:09 am

Related Questions

I have written code that automatically creates CSS sprites based on the IMG tags
Background: This is a request for something that may not exist yet, but I've
I'm about to create a web application that requires a lot of different web
I'm trying to create an html table for order logs for customers. A customer

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.