xsl-list
[Top] [All Lists]

sorting...

2003-07-14 13:39:00
Hi all,

I am having problem with alphabetical sort. 

This is the result I like to have.

A
        abcnews
        ABC
        Amazon
B
        bbb
        BBB
        Bike
F
        fff
        FFF


This is my code:

<xsl:key name="alpha-company-key" match="content" use="substring(company,1,1)" 
/>

<xsl:for-each  select="content[generate-id() = 
generate-id(key('alpha-company-key', translate(substring(company,1,1), 
'abcdefghijklmnopqrstuvwxyz', ABCDEFGHIJKLMNOPQRSTUVWXYZ'))[1])]">
        <xsl:value-of select="substring(company,1,1)"/>
        <xsl:for-each select="key('alpha-company-key', 
translate(substring(company,1,1), 'abcdefghijklmnopqrstuvwxyz', 
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))">
                <xsl:sort select="company/."/>
                <xsl:value-of select="../content/company"/>
        </xsl:for-each>
</xsl:for-each>


But the result of this code always skips the lower-case which looks like

A
        ABC
        Amazon
B
        BBB
        Bike
F
        FFF

Anything I'm doing wrong? You help is very appreciated!

        

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



<Prev in Thread] Current Thread [Next in Thread>