it fixes the issue Your problem here is basically with the way you currently have your document structured. The usage of "keys" under "vm" here that actually identify data points does not play well with the standard query forms and the aggregation framework in general.
XSLT2.0: How to use nested for-each-group to compress xml records
By : user2983001
Date : March 29 2020, 07:55 AM
I wish this help you I am trying to use nested for-each-group and for-each with current-group() to compress like data into one xml record based on two keys. The first key being ID and second being Inv_Link , Assuming your input sample is