I'm looking for suggestions on how to tackle this problem. I think it can be done using the for-each-group tag in XSLT 2.0. Basically, I've been given an export of FileMaker XML that looks like this:
In case nobody has had to work with FileMaker XML and XSL, it's kind of a pain in the you know what to work with sometimes. I need to transform this FileMaker XML into the following - grouping each value in column 1 together into a single attribute:
I'm thinking of taking the approach of iterating over the first column and gathering the values and the indices and then mixing and matching like that, but the for-each-group element in XSLT may provide what I'm really looking to do quickly and easily. Has anyone used that? Thanks!
So I've made some progress with this. Progress in sp far as I think I'm on the right track, I just don't quite know what track that is!!! Using the following stylesheet, I think I've managed to group my data by the values in column 1 using <xsl:key>. I then try and iterate over those groupings and get the corresponding values. As far as I can understand, there's one core issue with the stylesheet - the iteration over the group is isn't what I think it is. I think I'm iterating over a single value, which is a string of all the "groupings" (the values from COL/fmp:DATA) rather than some sort of array-like structure of each group name. Anyway, here's the stylsheet...
And here's the result:
This is promising, but not the result I'm looking for (see previous post). I kind of pulled this strategy together from some research on the web so I'm not quite sure what I'm doing. If anyone can shed some light I'd appreciate it!! Thanks!!!1 [ June 26, 2007: Message edited by: Brian R. Wainwright ]
Well I finally got this resolved so I'm posting the solution to anyone who may need to do something similar in the future. Basically I used XSL 2.0's for-each-group functionality to get distinct values of my first column. Then I iterate over those groups, and with a nested loop, iterate over ALL the values in that first column, grab the index I'm at and then grab the corresponding values in the other columns based on that index. Voila!