code: function xsltChoose(input, template, output) {
    for (var i = 0; i < template.childNodes.length; ++i) {
      var childNode = template.childNodes[i];
      if (childNode.nodeType != DOM_ELEMENT_NODE) {
        continue;
  
      } else if (childNode.nodeName == 'xsl:when') {
        var test = xmlGetAttribute(childNode, 'test');
        if (xpathEval(test, input).booleanValue()) {
          xsltChildNodes(input, childNode, output);
          break;
        }
  
      } else if (childNode.nodeName == 'xsl:otherwise') {
        xsltChildNodes(input, childNode, output);
        break;
      }
    }
  }
docs: Implements xsl:chose and its child nodes xsl:when and xsl:otherwise.