Subject: Re: [xsl] Re: Seeking an elegant XSLT function to check that a pair of numeric ranges are consecutive From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sat, 25 May 2024 21:18:36 -0000 |
> Recall the problem: determine if an integer range has no gaps in it. This is not the problem you provided to us. A sequence of overlapping intervals may be connected, but it violates the requirements for "consecutiveness". Thanks, Dimitre On Sat, May 25, 2024 at 2:02b/PM Roger L Costello costello@xxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > Fantastic responses - thank you! > > Recall the problem: determine if an integer range has no gaps in it. Till > now, I have been thinking that the way to solve the problem is to perform a > series of checks on pairs of ranges. But maybe there is a more general way > of looking at the problem ... > > Recall the XML document: > > <Document> > <Record> > <Range>0-2</Range> > </Record> > <Record> > <Range>3-7</Range> > </Record> > <Record> > <Range>8</Range> > </Record> > <Record> > <Range>9-15</Range> > </Record> > </Document> > > If we extract all the ranges, we get this sequence: > > (0-2, 3-7, 8, 9-15) > > Now the problem may be succinctly restated as: > > Is the sequence connected? > > It seems like XSLT should provide a built-in function that evaluates a > sequence for connectedness and returns true (the sequence is a connected > sequence) or false (the sequence is not a connected sequence). > > Does looking at the problem from the perspective of evaluating the > connectedness of an entire sequence rather than from the perspective of > evaluating the connectedness of a pair of ranges ... does that provide > insight into a different/better way of solving the problem? > > As far as I know, XSLT does not provide a built-in function that evaluates > a sequence (such as the one shown above) for connectedness. If XSLT did > have such a function, what would be the name of the function? > > /Roger
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: Seeking an elegant XS, David Carlisle d.p.c | Thread | Re: [xsl] Seeking an elegant XSLT f, Michael Kay mike@xxx |
Re: [xsl] Re: Seeking an elegant XS, David Carlisle d.p.c | Date | Re: [xsl] Seeking an elegant XSLT f, Michael Kay mike@xxx |
Month |