xsl-list
[Top] [All Lists]

Re: [xsl] Sorting with Different Sort Keys

2007-10-19 02:28:17
Abel Braaksma wrote:

<xsl:sort select="matches(., '\s*seite', 'i')" order="descending"  />
<xsl:sort select="not(matches(., '^\d+$'))" order="ascending"  />
<xsl:sort select="replace(., '\D', '')" order="ascending" data-type="number" />


note that technically the last line is semantically equivalent with the last line posted by Michael (and my order="ascending" is redundant):

<xsl:sort select="number(replace(., '[^0-9]', ''))"/>

also note that my first line contains an error and that its meaning is slightly different from the one posted by Michael, namely allowing for leading whitespace, here's the fixed version:

<xsl:sort select="matches(., '^\s*seite', 'i')" order="descending"  />

then, to finalize this little analysis: my middle line allows for all non-correct items to be put at the end in document order, even if they do contain a number, which could be rewritten (matter of taste) like this:

<xsl:sort select="matches(., '^\d+$')" order="descending"  />


-- Abel



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--