DOM L3 Xpath

WICD Full 1.0 #9

rendered
desired

All cars that have a name:

Mini One

Mini Cooper

Mini Cooper S

Mini Cooper D

Mini Secret Prototype 42C

//car/type[@name]

All Mini Coopers:

Mini Cooper

Mini Cooper S

Mini Cooper D

cars/car/type[contains(@name, 'Cooper')]

All Minis starting with "Mini O":

Mini One

cars/car/type[starts-with(@name, 'Mini O')]

The last car in the list:

Mini Secret Prototype 42C

//car/type[last()]

All cars that run on Diesel:

Mini Cooper D

//type[contains(@fuel, 'diesel')]

Cars with outknown engine specs..:

Mini Secret Prototype 42C

//type[not(@fuel)] | //type[not(@bhp)] | //type[not(@vmax)]

The car(s) in the middle of the list:

Mini Cooper S

//type[position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5)]

Fast cars

Mini Cooper

Mini Cooper S

//car/type[@vmax > 200]

This textcase has succeeded if the rendered and desired part look exactly the same.

An xml-file of several items and several attributes per item is created at first, then they are selected and displayed via the XPath-expressions displayed under them. (Note: on small display widths the XPath-expressions text might be cut off


Back