jQuery XPath 插件

jopen 11年前

这个插件是XPath 2.0查询语言完整功能实现,用于在所有web浏览器中查询HTML和XML文档。它基于XPath 2.0引擎 xpath.js实现。

$().xpath("0.1+0.2"); // Returns {Number} 0.3 (Note: in JavaScript it returns 0.30000000000000004)  $().xpath("xs:date('2012-12-12')-xs:yearMonthDuration('P1Y1M')"); // Returns {String} '2011-11-12'  $().xpath("2 to 5"); // Returns {Number} 2, 3, 4 and 5  $().xpath("for $var in (1, 2, 3) return $var * 3"); // Returns {Number} 3, 6 and 9  $().xpath("round-half-to-even(35540, -2)"); // Returns {Number} 35500  $().xpath("translate('bar','abc','ABC')"); // Returns {String} BAr  $().xpath("matches('helloworld', 'hello world', 'x')"); // Returns {Boolean} true  $().xpath("xs:double('-INF') castable as xs:decimal)"); // Returns {Boolean} false  $().xpath("1e2 instance of xs:double"); //  Returns {Boolean} true  $().xpath("1.5 cast as xs:integer"); // Returns {Number} 1

项目主页:http://www.open-open.com/lib/view/home/1367666863652