hxselect(1) extract elements that match a (CSS) selector


hxselect [ -i ] [ -c ] [ -l language ] [ -s separator ] selector


hxselect reads a well-formed XML document and outputs elements that match the CSS selector that is given as an argument. For example

hxselect ol li:first-child

selects the first li (list item in XHTML) in an ol (ordered list).

The command operates on the standard input.

Assumes that class selectors (".foo") refer to an attribute called "class".

Assumes that ID selectors ("#foo") refer to an attribute called "id".


The following options are supported:
Match case-insensitively. Useful for HTML and some other SGML-based languages.
Print content only. Without -c, the start and end tag of the matched element are printed as well; with -c only the contents of the matched element are printed.
-l language
Sets the default language, in case the root element doesn't have an xml:lang attribute (default: none). Example: -l en
-s separator
A string to print after each match (default: empty). Accepts C-like escapes. Example: -s '\\n\\n' to print an empty line after each match.
Show command usage.


The following operand is supported:
A selector. Most selectors from CSS level 3 are supported, with the exception of pseudo-classes, pseudo-elements and selectors with last- in their name.