|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Sorting alpha numeric values
Use two sort keys, one for the alpha part and one for the numeric part: <xsl:sort select="translate(@val, '0123456789', '')"/> <xsl:sort select="translate(@val, 'ABCDE....Z', '')" data-type="number"/> Michael Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Hugh Dixon > Sent: 09 May 2003 06:07 > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx > Subject: Sorting alpha numeric values > > > I have a data set: > <Root> > <Elem val = "A1"/> > <Elem val = "A2"/> > <Elem val = "A21"/> > <Elem val = "A3"/> > </Root> > > And a template: > > <xsl:template match="/"> > <xsl:for-each select="./Root/Elem"> > <xsl:sort select="@val"/> > <xsl:value-of select="./@val"/> > </xsl:for-each> > </xsl:template> > > I was hoping to sort the Elems into > A1 > A2 > A3 > A21 > > But I cannot get a hybrid alpha/numeric sort happening. Is > there some setting I'm missing, or could someone suggest how > I can do this. The ability to create a custom routine on > which to compare the values would be handy, although I > suspect the performance could be an issue. > > Thanks in Advance!! > > Hugh Dixon > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








