XSLT apply attribute depending on position
- by Burt
I am using XSLT for a website based on the 960 grid css framework.
I have columns of divs that span across the page if it is the first div in a row it should have a class first applied, if it is the middle one then no class and if it is the 3rd in the row it should have the class last applied.
I am really scratching my head as the best way to go about this any help is appreciated.
Below is the structure I want to end up with, the numbers inside the divs represent the position.
<div class="container_12">
<div id="main-content" class="alpha grid_12" style="margin-bottom: 20px;">
<div class="grid_4 alpha">
1
</div>
<div class="grid_4 ">
2
</div>
<div class="grid_4 omega">
3
</div>
<div class="grid_4 alpha">
4
</div>
</div>
</div>