-
Notifications
You must be signed in to change notification settings - Fork 0
XPath Model Examples
Nico Kutscherauer edited this page Feb 28, 2022
·
1 revision
This page shows some examples how XPath expressions are represented in the model.
XPath:
foo (:or child::foo, child::element(foo):)
Model:
<locationStep axis="child">
<nodeTest name="foo" kind="element"/>
</locationStep>XPath:
foo[@bar]
Model:
<locationStep axis="child">
<nodeTest name="foo" kind="element"/>
<predicate>
<locationStep axis="attribute">
<nodeTest name="bar" kind="attribute"/>
</locationStep>
</predicate>
</locationStep>XPath:
foo/bar
Model:
<operation type="step">
<arg>
<locationStep axis="child">...</locationStep>
</arg>
<slash/>
<arg>
<locationStep axis="child">...</locationStep>
</arg>
</operation>XPath:
foo/bar/baz
Model:
<operation type="step">
<arg>
<locationStep axis="child">...</locationStep>
</arg>
<slash/>
<arg>
<locationStep axis="child">...</locationStep>
</arg>
<slash/>
<arg>
<locationStep axis="child">...</locationStep>
</arg>
</operation>XPath:
foo = bar
Model:
<operation type="compare">
<arg>
<locationStep axis="child">...</locationStep>
</arg>
<eq/>
<arg>
<locationStep axis="child">...</locationStep>
</arg>
</operation>XPath:
foo eq bar
Model:
<operation type="value-compare">
<arg>
<locationStep axis="child">...</locationStep>
</arg>
<eq/>
<arg>
<locationStep axis="child">...</locationStep>
</arg>
</operation>XPath:
foo is bar
Model:
<operation type="node-compare">
<arg>
<locationStep axis="child">...</locationStep>
</arg>
<eq/>
<arg>
<locationStep axis="child">...</locationStep>
</arg>
</operation>XPath:
concat(foo, bar, baz)
Model:
<function-call>
<function name="concat"/>
<arg>
<locationStep axis="child">...</locationStep>
</arg>
<arg>
<locationStep axis="child">...</locationStep>
</arg>
<arg>
<locationStep axis="child">...</locationStep>
</arg>
</function-call>XPath:
'foo'
Model:
<string value="foo"/>XPath:
123
Model:
<integer value="123"/>XPath:
12.3
Model:
<decimal value="12.3"/>XPath:
$var
Model:
<varRef name="var"/>XPath:
.
Model:
<self/>XPath:
/
Model:
<root/>XPath:
()
Model:
<empty/>