Been reminiscing about music from my youth, a boy of the eighties there was so much going on back then. I was into some weird stuff Gene Loves Jezebel, the Boot Hill Foottappers, the list goes on, I was also into the Sisters of Mercy where the title for this post comes from. Im nothing if not consistent with my tenuous blog titles.
Quick question on an internal forum asking how to show just the first and last record in a group. XPATH to the rescue there are a couple of functions we can use to fetch just the first and last record. Lets assume we are looping over EMPLOYEES.
this will fetch all records. With the addition of the XPATH expression
<?for-each:EMPLOYEES[position()='1' or position()=last()]?>
The XPATH standard allows us to create a filter, if or boolean expression to limit the number of rows to be rendered.
position() - returns the current record being process. So position() = 1 will only return the first record
last() - returns the last record pointer. So position()=last() will give us the last record only.
Combining them together with an 'or' statement ensures we only get the first and last record in our group. Done!