1HXADDID(1) HTML-XML-utils HXADDID(1)
2
3
4
6 hxaddid - add IDs to selected elements
7
9 hxaddid [ -x ] [--] elem|.class|elem.class [ html-file ]
10
12 The hxaddid command copies an HTML or XML file to standard output,
13 while adding element IDs to the specified elements or classes.
14
15 For example, given the input
16
17 <p>A paragraph without an ID</p>
18
19 the command
20
21 hxaddid p
22
23 will output
24
25 <p id="a-paragraph">A paragraph without an ID</p>
26
27
28 If you specify a class using .class then IDs will only be added to ele‐
29 ments that contain that class. And if you specify an element and a
30 class using elem.class then IDs will only be added to the specified
31 elements that contain the specified class.
32
33 If two elements would naturally generate the same ID, a number is added
34 to the ID name (starting with 0) to make sure the IDs are unique. IDs
35 are not added to matching elements that already contain an ID.
36
38 The following options are supported:
39
40 -x Use XML conventions: empty elements are written with a slash
41 at the end: <IMG />. Also causes the element to be matched
42 case-sensitively.
43
45 The following operands are supported:
46
47 elem The name of element to select.
48
49 .class The name of class to select.
50
51 elem.class
52 The name of element that contains class to select.
53
54 html-file The name of an HTML file.
55
57 The following exit values are returned:
58
59 0 Successful completion.
60
61 > 0 An error occurred in the parsing of one of the HTML or XML
62 files.
63
65 asc2xml(1), hxprune(1), hxnormalize(1), hxnum(1), hxtoc(1), hxunent(1),
66 xml2asc(1), UTF-8 (RFC 2279)
67
69 Assumes UTF-8 as input. Doesn't expand character entities. Instead pipe
70 the input through hxunent(1) and asc2xml(1) to convert it to UTF-8.
71
72
73
745.x 21 Nov 2008 HXADDID(1)