1 <!-- http://mail.python.org/pipermail/xml-sig/2003-February/009070.html --> 2 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 3 <html> 4 <head> 5 <link rel="stylesheet" href="../../../js/resources/js-test-style.css"> 6 <script src="../../../js/resources/js-test-pre.js"></script> 7 </head> 8 <body> 9 <div id="console"></div> 10 11 <script> 12 SRC = '<?xml version=\'1.0\'?>\ 13 <alpha>\ 14 <beta no="a">\ 15 <gamma>\ 16 <delta>1</delta>\ 17 </gamma>\ 18 <delta mark="foo">2</delta>\ 19 <gamma mark="bar">\ 20 <delta>3</delta>\ 21 </gamma>\ 22 </beta>\ 23 <beta no="b">\ 24 <delta>4</delta>\ 25 <gamma>\ 26 <delta>5</delta>\ 27 </gamma>\ 28 </beta>\ 29 </alpha>'; 30 31 doc = (new DOMParser).parseFromString(SRC, "application/xml"); 32 33 expr = '/alpha/beta[attribute::no = "a"]' 34 nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 35 shouldBe('nodeset.snapshotLength', '1') 36 37 expr = '/alpha/beta[attribute::no = 1]' 38 nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 39 shouldBe('nodeset.snapshotLength', '0') 40 41 expr = '/alpha/beta[@no = "a"]' 42 nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 43 shouldBe('nodeset.snapshotLength', '1') 44 45 expr = '/alpha/beta[@no = 1]' 46 nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 47 shouldBe('nodeset.snapshotLength', '0') 48 49 var successfullyParsed = true; 50 51 </script> 52 <script src="../../../js/resources/js-test-post.js"></script> 53 </body> 54 </html> 55