Name

lxviewport — Run a program on selected parts of an XML document

Synopsis

lxviewport [ -xmlns[:prefix]=uri ...] -q query [ -e ] program [ input-file ]

Description

lxviewport filters parts (subtrees) of an XML document through an external program. The parts to be filtered are identified by an XPath query. The program is run once for each matching subtree, and the program's output replaces the subtree in the document.

The input-file argument may be a URI instead of a filename. If no input-file argument is given, standard input is used.

-xmlns[:prefix]=uri

binds a prefix (or the default namespace) to a URI for use in XPath queries.

-q query

an XPath query identifying the parts of the program that are to be filtered. This query is streamed.

-e

causes the program output to be parsed as an external parsed entity rather than an XML document. This allows the program to produce multiple elements or text not enclosed in an element.

program

the program to be run on each matching subtree.

Bugs

Since the program is run once for each matching subtree, it may take a long time to process a large document.