Section: HTML-XML-utils (1)
Updated: 10 Jul 2011Index
Return to Main Contents
hxselect - extract elements that match a (CSS) selector
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
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
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:
- -s separator
A string to print after each match (default: empty). Accepts
C-like escapes. Example:
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.