| /AAA/DDD/BBB |
/ Absolute Path |
| //BBB |
// Any Parent Nodes |
| /AAA/CCC/DDD/* |
* Any Sub-Node |
| /*/*/*/BBB |
* Any Node |
| //* |
* All of them |
| /AAA/BBB[1] |
[1] Index one,The first index is 1 |
| /AAA/BBB[last()] |
[last()] the Last BBB Node |
| //@id |
get all properties named “id” |
| //BBB[@id] |
Get elements which has property named "id" |
| //BBB[@name] |
Get elements which has property named "name" |
| //BBB[@*] |
Get elements which has any property |
| //BBB[not(@*)] |
Get elements which has no properties |
| //BBB[@id='b1'] |
Get element which has a "id" valued "b1" |
| //BBB[@name='bbb'] |
Get element which has a "name" valued "bbb" |
| //BBB[normalize-space(@name)='bbb'] |
"normalize-space"=trim() |
| //*[count(BBB)=2] |
Node have 2 sub-nodes named "BBB" |
| //*[count(*)=2] |
Node have 2 sub-nodes |
| //*[name()='BBB'] |
name() return the name of node |
| //*[starts-with(name(),'B')] |
start-with() check the prefix |
| //*[contains(name(),'C')] |
Contains()=indexOf()>=0 |
| //*[string-length(name()) = 3] |
string-length()=string.length,= > < >!!!! |
| //CCC | //BBB |
| = or |
| /child::AAA |
"child" is optional |
| /descendant::* |
|
| /AAA/BBB/descendant::* |
|
| //CCC/descendant::* |
|
| //CCC/descendant::DDD |
|
| //DDD/parent::* |
include Select Parent Node |
| /AAA/BBB/DDD/CCC/EEE/ancestor::* |
include Select Parent Node to Root |
| //FFF/ancestor::* |
|
| /AAA/BBB/following-sibling::* |
siblings |
| //CCC/following-sibling::* |
|
| /AAA/XXX/preceding-sibling::* |
Prev-siblings |
| //CCC/preceding-sibling::* |
|
| /AAA/XXX/following::* |
all of the Next nodes in the documents |
| //ZZZ/following::* |
|
| /AAA/XXX/preceding::* |
all of the preceding nodes in the doc |
| //GGG/preceding::* |
**Node**
name(a) local-name(a) namespace-uri(a)
lang(lang) root(node)
**Context**
position() last() current-dateTime()
current-date() current-time()
**Aggregate**
count(...) avg(...) max(...) min(...)
sum(...)
**Generate Sequense**
id() idref() doc() doc-available(a)
collection()
**Date Time**
dateTime(date,time)
years-from-dateTime(a) months-from-dateTime
days-from-dateTime hours-from-dateTime
minutes-from-dateTime seconds-from-dateTime
**boolean**
true boolean(a) not(a) true() false()=
**NUMERIC**
number(arg) abs(num) ceiling(num)
floor(num) round(num) |
| /AAA/XXX/descendant-or-self::* |
| //CCC/descendant-or-self::* |
| /AAA/XXX/DDD/EEE/ancestor-or-self::* |
| //GGG/ancestor-or-self::* |
| //GGG/ancestor::* |
| //GGG/descendant::* |
| //GGG/following::* |
| //GGG/preceding::* |
| //GGG/self::* |
| //GGG/ancestor::* | //GGG/descendant::* |
| //BBB[position() mod 2 = 0 ] |
**STRING**
string(a) compare(a,b) concat(a,...)
string-join(...) substring(a,n,len)
string-length(a) normalize-space(a)
upper-case(a) lower-case(a)
contains(a,s) starts-with ends-with
substring-before substring-after
replace(s,p,rv) matches(s,p)
tokenize(string, pattern)
translate(s,s1,sre)*replace nop.
|