Grab last item in XSLT for-each


This is simple and fun!

Here’s an example of doing something in all instances EXCEPT the last one. Reversing this is obvious:

 

Often times you want a horizontal rule in all instances except the last item. You can also use this method for adding a class name to the last item:

  • last
  • Share and Enjoy:
    • Print
    • Digg
    • StumbleUpon
    • Slashdot
    • del.icio.us
    • Facebook
    • Mixx
    • Google Bookmarks
    • Share/Bookmark
    1. No comments yet.
    (will not be published)