• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

XSL 2.0 (looking for ideas)

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

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!
 
Brian R. Wainwright
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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[1]/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 ]
 
Brian R. Wainwright
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!

 
This tiny ad is guaranteed to be gluten free.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic