Consider the following use case. I have a timesheet form that has a repeat control nested inside another repeat control. The first repeat loops through the days of the week while the second loops through a set number of possible project entries per day. I want to have all but the first row hidden for each day on load of a new timesheet, then have buttons to add a line and remove a line. I can use jQuery but instead of trying to add the row number to my class attribute of each row, or trying to parse out the id I can use a new attribute called "rowNum" and grab that on the client side.
<xp:repeat id="timesheetCard" indexVar="idx" var="rowNum" repeatControls="true" rows="7">
Now, on the client side wherever I want to have access to this row I can access it via jQuery as shown here:
The above code will find the row with a row=5 and show that row. This would be useful if I had that row hidden previously.
The above is not the only possible use case for 'attr'. You can use it anywhere you want to add additional metadata to your markup for use client-side. A nice tool to have in your toolbox!