| <!-- 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-pre.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> |
| <script src="../../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |