Hi,
I found this question to be quite a challenge because it requires procedural processing of your data, which does not sit comfortably with xsl’s declarative nature. I have attached an example which worked for me - I hope it gives you some ideas. Basically it steps through all the A items. For each A item it creates a new group and copies the A item. Then it locates the next A item, and explicitly copies all the B items which lie between the two A items. Before starting I had to remove whitespace from the xml because it interfered with the principle of node counting.
I would hope that there is a better way to do this, but I couldn’t find one.
HTH
test.xsl (1.56 KB)
#Tamino#webMethods#API-Management