code: function xsltSort(input, template) {
    var sort = [];
    for (var i = 0; i < template.childNodes.length; ++i) {
      var c = template.childNodes[i];
      if (c.nodeType == DOM_ELEMENT_NODE && c.nodeName == 'xsl:sort') {
        var select = xmlGetAttribute(c, 'select');
        var expr = xpathParse(select);
        var type = xmlGetAttribute(c, 'data-type') || 'text';
        var order = xmlGetAttribute(c, 'order') || 'ascending';
        sort.push({ expr: expr, type: type, order: order });
      }
    }
  
    xpathSort(input, sort);
  }
docs: Orders the current node list in the input context according to the sort order specified by xsl:sort child nodes of the current template node. This happens before the operation specified by the current template node is executed.  TODO(mesch): case-order is not implemented.