Re: [xsl] XPath expression to convert XSD enumerations into aregex, longest value first

Subject: Re: [xsl] XPath expression to convert XSD enumerations into aregex, longest value first
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Jul 2022 10:52:18 -0000
> On 8 Jul 2022, at 11:23, Roger L Costello costello@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>> At this point we're stuck because the requirements aren't clear.
>> In the example, 12 appeared in the output before 11, but we
>> don't know why: there was nothing in the requirements
>> statement that said it should.
>
> The only requirement is for the longer strings to come first.
>
> So any of these results would be fine:
>
> 12|11|10|9|8|7|6|5|4|3|2|1
> 11|12|10|9|8|7|6|5|4|3|2|1
> 10|11|12|9|8|7|6|5|4|3|2|1
> 12|11|10|1|2|3|4|5|6|7|8|9
> ...
>
> What is the simplest XPath expression to achieve that result?
>
> /Roger


In that case it's simplest to sort the numbers by their value rather than by
their length, since that will produce one of the acceptable orderings.

Michael Kay
Saxonica

Current Thread