Imagine that you have an xml document containing record elements. Record elements contain column elements, which have name attributes. The record elements are ordered by the text content of the column with the name purchaseOrder. You want to transform this so the the record elements are separated into groups with each group containing records with the same purchase order value.
The imperative solution is pretty obvious. Have a variable that keeps track of the purchaseOrder value of the previous record. Loop over the records and each time the purchaseOrder of the record being processed is different from the previous purchaseOrder you've reached the start of a new group.
Of course in XSLT you can't update the value of a variable so this solution isn't going to work. One way to do it is to recursively process the list of records. In XSLTXT it looks like this which in XSLT looks like this.
Posted by Alex at November 11, 2002 09:45 PM