chromium/third_party/blink/web_tests/fast/xpath/4XPath/Borrowed/cz_20030217.html

<!-- http://mail.python.org/pipermail/xml-sig/2003-February/009070.html -->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../resources/js-test.js"></script>
</head>
<body>
<div id="console"></div>

<script>
    SRC = '<?xml version=\'1.0\'?>\
<alpha>\
  <beta no="a">\
    <gamma>\
      <delta>1</delta>\
    </gamma>\
    <delta mark="foo">2</delta>\
    <gamma mark="bar">\
      <delta>3</delta>\
    </gamma>\
  </beta>\
  <beta no="b">\
    <delta>4</delta>\
    <gamma>\
      <delta>5</delta>\
    </gamma>\
  </beta>\
</alpha>';

    doc = (new DOMParser).parseFromString(SRC, "application/xml");

    expr = '/alpha/beta[attribute::no = "a"]'
    nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe('nodeset.snapshotLength', '1')

    expr = '/alpha/beta[attribute::no = 1]'
    nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe('nodeset.snapshotLength', '0')

    expr = '/alpha/beta[@no = "a"]'
    nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe('nodeset.snapshotLength', '1')

    expr = '/alpha/beta[@no = 1]'
    nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe('nodeset.snapshotLength', '0')

</script>
</body>
</html>