XSLT Sort Alphabetically & Numerically Problem

Posted by Bryan on Stack Overflow See other posts from Stack Overflow or by Bryan
Published on 2010-04-19T19:31:51Z Indexed on 2010/04/19 19:33 UTC
Read the original article Hit count: 315

Filed under:
|
|
|

I have a group of strings ie g:lines = '9,1,306,LUCY,G,89'

I need the output to be:

1,9,89,306,G,LUCY

This is my current code:

<xsl:for-each select="$all_alerts[g:problem!='normal_service'][g:service='bus']">
  <xsl:sort select="g:line"/>
  <xsl:sort select="number(g:line)" data-type="number"/>
  <xsl:value-of select="normalize-space(g:line)" /><xsl:text/>
  <xsl:if test="position()!=last()"><xsl:text>,&#160;</xsl:text></xsl:if>
</xsl:for-each>

I can get it to only display '1, 12, 306, 38, 9, G, LUCY' because the 2nd sort isn't being picked up.

Anyone able help me out?

© Stack Overflow or respective owner

Related posts about xsl

Related posts about sorting