$ command line cheat sheets
Cheat Sheet Title: [ no_spaces_alphanumeric_only ]
Cheat Sheet:XPath examples ============== //hr[@class='edge' and position()=1] every first hr of 'edge' class //table[count(tr)=1 and count(tr/td)=2] all tables with 1 row and 2 cols //div/form/parent::* all divs that have form ./div/b a relative path //table[parent::div[@class="pad"] and not(@id)]//a any anchor in a table without id, contained in a div of "pad" class /html/body/div/*[preceding-sibling::h4] give me whatever after h4 //tr/td[font[@class="head" and text()="TRACK"]] all td that has font of a "head" class and text "TRACK" ./table/tr[last()] the last row of a table //rdf:Seq/rdf:li/em:id using namespaces //a/@href hrefs of all anchors //*[count(*)=3] all nodes with 3 children //var|//acronym all vars and acronyms XPath functions =============== Conversion: boolean([object]) string([object]) number([object]) Math: ceiling(number) floor(number) round(decimal) sum(node-set) Logic: true() false() not(expr) Node: lang(string) name([node-set]) namespace-uri([node-set]) text() Context: count(node-set) function-available(name) last() position() String: contains(haystack-string needle-string) concat(tring1 string2[stringn]*) normalize-space(string) starts-with(haystack needle) string-length([string]) substring(string start[length]) substring-after(haystack needle) substring-before(haystack needle) translate(string abc XYZ) XPath Axes ========== Axes are relations two nodes. Each axis has also shortcut (in parenthesis). * ancestor * ancestor-or-self * attribute (@) * child (/) * descendant (//) * descendant-or-self * following * following-sibling * parent(..) * preceding * preceding-sibling * self (.)
Your cheat sheet will be editable (fixable) by anyone. Each cheat sheet is essentially a wiki page. It may also be used by millions of people for reference purposes from the comfort of their command line. If this is okay with you, please save.