1XMLIF(1) xmlif XMLIF(1)
2
3
4
6 xmlif - conditional processing instructions for XML
7
9 xmlif [attrib=value...]
10
12 xmlif filters XML according to conditionalizing markup. This can be
13 useful for formatting one of several versions of an XML document
14 depending on conditions passed to the command.
15
16 Attribute/value pairs from the command line are matched against the
17 attributes associated with certain processing instructions in the
18 document. The instructions are <?xmlif if?> and its inverse <?xmlif if
19 not?>, <?xmlif elif?> and its inverse <?xmlif elif not?>, <?xmlif
20 else?>, and <?xmlif fi?>.
21
22 Argument/value pairs given on the command line are checked against the
23 value of corresponding attributes in the conditional processing
24 instructions. An `attribute match´ happens if an attribute occurs in
25 both the command-line arguments and the tag, and the values match. An
26 `attribute mismatch´ happens if an attribute occurs in both the
27 command-line arguments and the tag, but the values do not match.
28
29 Spans between <?xmlif if?> or <?xmlif elif?> and the next conditional
30 processing instruction at the same nesting level are passed through
31 unaltered if there is at least one attribute match and no attribute
32 mismatch; spans between <?xmlif if not?> and <?xmlif elif not?> and the
33 next conditional processing instruction are passed otherwise. Spans
34 between <?xmlif else?> and the next conditional-processing tag are
35 passed through only if no previous span at the same level has been
36 passed through. <?xmlif if?> and <?xmlif fi?> (and their `not´
37 variants) change the current nesting level; <?xmlif else?> and <?xmlif
38 elif?> do not.
39
40 All these processing instructions will be removed from the output
41 produced. Aside from the conditionalization, all other input is passed
42 through untouched; in particular, entity references are not resolved.
43
44 Value matching is by string equality, except that "|" in an attribute
45 value is interpreted as an alternation character. Thus, saying
46 foo=´red|blue´ on the command line enables conditions red and blue.
47 Saying color=´black|white´ in a tag matches command-line conditions
48 color=´black´ and color=´white´.
49
50 Here is an example:
51
52 Always issue this text.
53 <?xmlif if condition=´html´?>
54 Issue this text if ´condition=html´ is given on the command line.
55 <?xmlif elif condition=´pdf|ps´?>
56 Issue this text if ´condition=pdf´ or ´condition=ps´
57 is given on the command line.
58 <?xmlif else?>
59 Otherwise issue this text.
60 <?xmlif fi?>
61 Always issue this text.
62
64 Eric S. Raymond <esr@snark.thyrsus.com>
65 Author of xmlif program
66
67
68
69Linux April 2009 XMLIF(1)