Greetings,
I'm trying to use XSLT 2.0 to create a new set of grouped ranges based on an aggregation of a set of non-contiguous individual ranges. What makes this more complicated is that my data values are in text nodes. Example:
Given a range of numbers as an individual set:
- 150-202
- 201-225
- 201-204
- 205-234
- 226-234
I'm trying to produce a new grouping based on the way the groups overlap:
- 150-200 (this is where group 1 starts and overlaps to group 2 & 3)
- 201-202 (this is where 1 & 2 overlap, and group 1 ends)
- 203-204 (this is where 2 & 3 overlap and 3 ends)
- 205-225 (this is where 4 starts and begins to overlap with 5)
- 226-234 (this is where 4 & 5 overlap and end)
The start and end point of the individual ranges form the boundaries.
My source data is formatted like this, as a text node:
<range>150-202, 201-225, 201-204, 205-234, 226-234</range>
I've been using an xsl:sequence to create a new sequence containing all the numbers of a range, so I can do compares against individual numbers in the entire range, if necessary.
I'm thinking along the lines of:
- Grab all the individual numbers from the entire group, remove duplicates, and form boundaries where the number sequence is interrupted. But this doesn't take into account overlap.
Help appreciated!
Thanks,
Michael Friedman