|
Subject: Re: [xsl] Algorithm for determining ranges From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 5 Jun 2026 15:39:41 -0000 |
On 05/06/2026 17:31, rick@xxxxxxxxxxxxxx wrote: > > Thank you Martin! I need to unravel the select clause on the grouping; > there are some concepts I donbt understand. > > > B B B <xsl:for-each-group select="xref" group-adjacent="let $numbers > := tokenize(., '\.') ! xs:integer(.) return > string-join(($numbers[position() lt last()], $numbers[last()] - > position() + 1), '.')"> > The B B let $numbers := tokenize(., '\.') ! xs:integer(.) breaks up the e.g. 16.2.0 value into a sequence of three integers 16, 2, 0, then the grouping key for each item is computed by maintaining the leading numbers in that sequence but by computing B B $numbers[last()] - position() + 1 for the last number, if these form a range that computation will give the same number for a range and then the string-join just re-assembles the complete value (for the group-adjacent key). Of course the B - position() + 1 could also just be B - position() but I thought it to be more logical to make sure the first item's group key is the value given in the xref element and not a value where the last number is decremented.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Algorithm for determining, Michael Kay mike@xxx | Thread | Re: [xsl] Algorithm for determining, rick@xxxxxxxxxxxxxx |
| Re: [xsl] Algorithm for determining, Michael Kay mike@xxx | Date | Re: [xsl] Algorithm for determining, rick@xxxxxxxxxxxxxx |
| Month |