I want to modify the expand.xsl sheet so that the steps between 2 labels are grouped under one section like how it happens for the subsequence calls in the teststand report.

For example the sequence in the previous screenshot generates a report that looks like -

The last step is a Label step with its icon and name hidden.
Is it possible to modify the stylesheet so that steps between the first label and the last label are part of one group in the report? If yes how can that be done?
I don't have much experience with style sheets. I can do basic modifications to change background colors of certain sections or skip specific data from getting printed in the report. If I can get the code that needs to be included in the existing stylesheet then that would be helpful.