Jump to content

Counting Preceding-Sibling Rows, But Not All Of Them.


Rover

Recommended Posts

I'm trying to count preceing sibbling <row> elements, but don't want to include all preceding-siblings. I'd like to stop counting as soon as I hit a row that contains a "rowsep" attribute. I'm doing this so that I can alternate background colors on the table rows, but need to start over with the colors each time I hit a <row> with a rowsep attribute. Example XML: <row rowsep="1"><entry/></row> <row><entry/></row> <row rowsep="1"><entry></row> <row><entry/></row> For this row, I'd like my preceding siblings to be zero because the preceding row has a rowsep attr.. <row><entry/></row> <row><entry/></row> <row rowsep="1"><entry></row> <row><entry/></row> For this row, I'd like my preceding siblings to be zero because the preceding row has a rowsep attr.. <row><entry/></row> <row><entry/></row> Thank you!

Link to comment
Share on other sites

I'd like to use XSLT 1.0 Output is HTML. Given the XML above, I'd like the following HTML.<tr style="rowsep"><td/></tr> This is start of table.<tr style="red"><td/></tr><tr style="rowsep"><td/></tr><tr style="red"><td/></tr><tr><td/></tr><tr style="red"><td/></tr><tr style="rowsep"><td/></tr><tr style="red"><td/></tr><tr><td/></tr><tr style="red"><td/></tr> I need to have style="red" on the row folowing a row with a "rowsep" and then style="red" on every other row until I hit another row with "rowsep". A row with style "rowsep" starts a new section of rows. The row following the "rowsep" row should be "red" and this needs to alternate rows.I'm trying to use a count preceding-sibling and "mod" function to determin if the row should be "red".Thank you!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...