RE: [xsl] collapsing number ranges

Subject: RE: [xsl] collapsing number ranges
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 27 Aug 2004 09:31:54 +0100
> Is there some easy way -- in XSLT 2.0 -- to handle in a general way 
> collapsing number ranges like:
> 
> 23-24 => 23-4
> 333-334 => 333-34
> 7777-7778 => 7777-78
> 

I can't tell from these three examples what your algorithm is. If the second
number were to contain all trailing digits that differ from those of the
first number, then it's doable - but I don't think there's an "easy way"
even then. You just have to work through the second string outputting each
digit only if the substring up to and including that digit differs from the
leading substring of the same length in the other number - which can
probably be done in 1.0 as easily as in 2.0.

Michael Kay

Current Thread