|Linux & Unix Commands - Search Man Pages
xmlif - conditional processing instructions for XML
xmlif filters XML according to conditionalizing markup. This can be useful for formatting
one of several versions of an XML document depending on conditions passed to the command.
Attribute/value pairs from the command line are matched against the attributes associated
with certain processing instructions in the document. The instructions are <?if> and its
inverse <?if not>, <?elif> and its inverse <?elif not>, <?else>, and <?fi>.
Argument/value pairs given on the command line are checked against the value of corre-
sponding attributes in the conditional processing instructions. An `attribute match' hap-
pens if an attribute occurs in both the command-line arguments and the tag, and the values
match. An `attribute mismatch' happens if an attribute occurs in both the command-line
arguments and the tag, but the values do not match.
Spans between <?if> or <?elif> and the next conditional processing instruction at the same
nesting level are passed through unaltered if there is at least one attribute match and no
attribute mismatch; spans between <?if not> and <?elif not> and the next conditional pro-
cessing instruction are passed otherwise. Spans between <?else> and the next conditional-
processing tag are passed through only if no previous span at the same level has been
passed through. <?if> and <?fi> (and their `not' variants) change the current nesting
level; <?else> and <?elif> do not.
All these processing instructions will be removed from the output produced. Aside from the
conditionalization, all other input is passed through untouched; in particular, entity
references are not resolved.
Value matching is by string equality, except that "|" in an attribute value is interpreted
as an alternation character. Thus, saying foo='red|blue' on the command line enables con-
ditions red and blue. Saying color='black|white' in a tag matches command-line conditions
color='black' and color='white'.
Here is an example:
Always issue this text.
Issue this text if 'condition=html' is given on the command line.
Issue this text if 'condition=pdf' or 'condition=ps'
is given on the command line.
Otherwise issue this text.
Always issue this text.
The mark-up used by this tool is not set in stone, and may change in the near future.
Eric S. Raymond.
Sep 26 2002 XMLIF(1)
All times are GMT -4. The time now is 07:12 PM.