xsl-list
[Top] [All Lists]

RE: Muenchian Sorting with Substrings and Translated Strings...

2004-02-22 01:04:32
-----Original Message-----
From: Brook Ellingwood

My first challenge is that I want to change the ProductFamily sort so that
it groups first by the alpha characters, and then by the numerical ones. I
seems that I need to turn the value of ProductFamily into a
string so I can sort on substrings but that can't work.


How about something like:

<xsl:variable name="$numeric" select="'1234567890'" />
<xsl:variable name="$alpha"
select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
...
<xsl:apply-templates select="Product">
  <xsl:sort select="concat(

translate(ProductFamily,$numeric,''),translate(ProductFamily,$alpha,''))" />
</xsl:apply-templates>

So you sort on a concatenation of all the ProductFamily's alpha characters
and its numerics, in the right order for your convenience. (You only still
need to deal with the &quot; entities, and the decimal-points...)

Hope this gives you an idea!

Cheers,

Andreas


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



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