title: How to apply an alphanumeric sort in XSLT
body: <p>Based on the following XML, what is the best way to achieve an alphanumeric sort in XSL?</p>
  
  <p><strong><em>Edit</strong>: to clarify, the XML below is just a simple sample the real XML would contain much more variant values.</em></p>
  
  <pre><code>&lt;colors&gt;
    &lt;item&gt;
      &lt;label&gt;Yellow 100&lt;/label&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;label&gt;Blue 12&lt;/label&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;label&gt;Orange 3&lt;/label&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;label&gt;Yellow 10&lt;/label&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;label&gt;Orange 26&lt;/label&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;label&gt;Blue 117&lt;/label&gt;
    &lt;/item&gt;
  &lt;/colors&gt;
  </code></pre>
  
  <p>E.g. I want a final outcome in this order:</p>
  
  <pre><code>Blue 12, Blue 117, Orange 3, Orange 26, Yellow 10, Yellow 100
  </code></pre>
  
  <p>This is "<em>effectively</em>" what I would want.</p>
  
  <pre><code>&lt;xsl:apply-templates select="colors/item"&gt;
    &lt;xsl:sort select="label" data-type="text" order="ascending"/&gt;&lt;!--1st sort--&gt;
    &lt;xsl:sort select="label" data-type="number" order="ascending"/&gt;&lt;!--2nd sort--&gt;
  &lt;/xsl:apply-templates&gt;   
  
  &lt;xsl:template match="item"&gt;
    &lt;xsl:value-of select="label"/&gt;
    &lt;xsl:if test="position() != last()"&gt;,&lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
  </code></pre>