My other task is take an element and group it into groups of 14.
I recall from the past that even incrementing a counter is kind of tricky. So while I'm looping, if the counter is < 14 I move a group to a a group, but once the counter is 14, I have to reset counter to 1, and start a new group on the target doc.
Any suggestions or tricks? Seems like last time I needed a counter the easiest way to do it was with a C# subroutine (I'm in the .NET world).
See attached. The goal in this simplified version is to group the line-items by 3. The first three line items go together, then the second three, then the 7th one is left by itself.
Here's where I'm headed, ( am properly displaying the position() and the mods, but what's confusing me is how to write out the <body> tag optionally - and to keep the XML in the XSLT well-formed i.e. "balanced".
Please see attached. It seems to work, but I'd like a second opinion if it is the best way or not. I had to put some of the <body> tags in CDATA to fool the parser.