Re: [xsl] Algorithm for determining ranges

Subject: Re: [xsl] Algorithm for determining ranges
From: "rick@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 5 Jun 2026 14:46:48 -0000
Hi Martin,



The last number is where the ranges should be. Thank you.



Rick



From: Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, June 5, 2026 10:37 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Algorithm for determining ranges





On 05/06/2026 16:09, rick@xxxxxxxxxxxxxx <mailto:rick@xxxxxxxxxxxxxx>  wrote:



Here is my XML:



<?xml version="1.0" encoding="UTF-8"?>
<xrefs>
    <xref>16.1.0</xref>
    <xref>16.2.1</xref>
    <xref>16.2.2</xref>
    <xref>16.2.3</xref>
    <xref>16.14.2</xref>
    <xref>16.22.0</xref>
</xrefs>




I need to determine ranges, like this:



<?xml version="1.0" encoding="UTF-8"?>
<xrefs>
    <xref>16.1.0</xref>
    <xref>16.2.1</xref>
    <range/>
    <xref>16.2.3</xref>
    <xref>16.14.2</xref>
    <xref>16.22.0</xref>
</xrefs>



I am trying to determine an XSLT 3.0 algorithm for doing this. I am looking
for suggestions. Thank you in advance.



Hi Rick,

is that always a range based on the last number? Is there some spec as to what
the number can be e.g. 0..9?

Looks like a job for xsl:for-each-group group-adjacent, perhaps with some
accumulator.

XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>

EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/612310>  (by
email <> )

Current Thread