1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<html>
<head>
<title>Syntax highlighting for DocBook program listings</title>
</head>
<body style="background:#ffffff;">
<h1>Syntax highlighting for DocBook program listings</h1>
<p>Highlight content of <tt>ProgramListing</tt> using <a href="http://xsieve.sourceforge.net/">XSieve</a> and Vim. Example:</p>
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<th valign="top">DocBook</th>
<td>
<pre style="background:#f0f0f0;"><programlisting role="xml">
&lt;para>Hello, <emphasis>&amp;who;</emphasis
>!&lt;/para> <co id="who-entity"/>
</programlisting></pre>
</td>
</tr>
<tr>
<th>HTML result </th>
<td>
<pre style="background:#f0f0f0;">
<span style="color:#008B8B;"><para></span>Hello, <span class="emphasis"><em><span style="color:#2E8B57; font-weight:bold;">&</span><span style="color:#A52A2A; font-weight:bold;">who</span><span style="color:#2E8B57; font-weight:bold;">;</span></em></span>!<span style="color:#008B8B;"></para></span> (1)</pre>
</td>
</tr>
</table>
<a href="xsieve-programlisting.zip">Download</a> xsieve-programlisting.zip.
<h2>Usage</h2>
<p>Set the correct path to the script <tt>vimcolor-wrapper</tt> in <tt>colorer.xsl</tt>.</p>
<p>Create an XSLT wrapper which imports DocBook and colorer stylesheets:</p>
<pre style="background:#f0f0f0;">
<font color="#008b8b"><</font><font color="#6a5acd">xsl</font><font color="#0000ff">:</font><font color="#a52a2a"><b>stylesheet</b></font><font color="#008b8b"> ...></font>
...
<font color="#008b8b"><</font><font color="#6a5acd">xsl</font><font color="#0000ff">:</font><font color="#a52a2a"><b>import</b></font><font color="#008b8b"> </font><font color="#2e8b57"><b>href</b></font>=<font color="#ff00ff">"..../docbook.xsl"</font><font color="#008b8b">></font> (1)
<font color="#008b8b"><</font><font color="#6a5acd">xsl</font><font color="#0000ff">:</font><font color="#a52a2a"><b>import</b></font><font color="#008b8b"> </font><font color="#2e8b57"><b>href</b></font>=<font color="#ff00ff">"..../colorer.xsl"</font><font color="#008b8b">></font> (2)
<font color="#008b8b"><</font><font color="#6a5acd">xsl</font><font color="#0000ff">:</font><font color="#a52a2a"><b>import</b></font><font color="#008b8b"> </font><font color="#2e8b57"><b>href</b></font>=<font color="#ff00ff">"..../colorer-html.xsl"</font><font color="#008b8b">></font> (3)
... Your DocBook customization layer ...
<font color="#008b8b"></</font><font color="#6a5acd">xsl</font><font color="#0000ff">:</font><font color="#a52a2a"><b>stylesheet</b></font><font color="#008b8b">></font>
</pre>
<p><b>(1)</b> The path to the DocBook XSLT stylesheet. For example, <tt>/usr/share/xml/docbook/xsl-stylesheets/html/docbook.xsl</tt><br />
<b>(2)</b> The path to the colorer XSLT stylesheet.<br />
<b>(3)</b> Or <tt>colorer-fo.xsl</tt> for FO output.</p>
<h2>Test data</h2>
<p>The package contains test files <tt>test.xml</tt>, <tt>testdoc.xsl</tt> and <tt>testdoc.html</tt>. Use them as the starting point:</p>
<pre>xsieve -o testdoc.html --param callout.graphics 0 testdoc.xsl test.xml</pre>
</body>
</html>