Is there a built-in or simple way to generate a sequence of values that will sort in alphabetical order?

As an example, the following item elements have a child sequence element intended for sorting on. The data is being generated for another system that requires this information, since it does not work with the document ordering.

```
<list>
    <item>
        <sequence>1</sequence>
    </item>
    <item>
        <sequence>2</sequence>
    </item>
    <item>
        <sequence>3</sequence>
    </item>
    <item>
        <sequence>4</sequence>
    </item>
    ...
    <item>
        <sequence>14</sequence>
    </item>
    <item>
        <sequence>15</sequence>
    </item>

```

Instead of sorting numerically, the system sorts alphabetically and it cannot change this behavior. As a result the items are sorted as 1,10,11,12,13,14,15,2,3,4,5,6,7,8,9

Furthermore, the actual number of items is unbounded, so there needs to be general way of generating an alphabetic sequence that will sort in the right order. That said, the number of items should be relatively small, under 1000.

This is what I have so far:

```
<xsl:variable name="idchars" as="xs:string *" 
    select="
        ('0','1','2','3','4','5','6','7','8','9',
         'A','B','C','D','E','F','G','H','I','J','K','L','M',
         'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
         'a','b','c','d','e','f','g','h','i','j','k','l','m',
         'n','o','p','q','r','s','t','u','v','w','x','y','z')
    "
/>

<xsl:variable name="idlen" as="xs:integer" select="count($idchars)" />

<xsl:function name="f:genId" as="xs:string">
    <xsl:param name="pSeq" as="xs:integer" />
    <xsl:variable name="vLen" as="xs:integer" select="$pSeq idiv $idlen" />

    <xsl:value-of>
        <xsl:for-each select="1 to $vLen">
            <xsl:sequence select="$idchars[$idlen]" />
        </xsl:for-each>
        <xsl:sequence select="$idchars[$pSeq mod $idlen]" />
    </xsl:value-of>
</xsl:function>

```