XSLTXT code for grouping using the Muenchian Method. Syntax highlighting is provided by XSLTXT mode in emacs.
stylesheet "1.0" import "common.txt" output .method "text" key "records-by-purchaseOrder" "record" "column[@name = 'purchaseOrder']" tpl .match "/resultSet" "Start" for-each "record[count(. | key('records-by-purchaseOrder', column[@name = 'purchaseOrder'])[1]) = 1]" # This is the start of a group so apply some sort of # groupHeader template to the first record apply .select "." .mode "groupHeader" # Apply some sort of groupBody template to all of the records in the group apply .select "key('records-by-purchaseOrder', column[@name = 'purchaseOrder'])" .mode "groupBody"