XML processors, and in particular XSLT or CSS stylesheets can tune the way they handle or display elements in clever and convenient ways. For instance, we can add a lang attribute on the <book> and an id attribute on the <chapter> tags in the previous example and get the following:
Example 1.5. A small DocBook file showing the use of attributes
1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "/afs/cern.ch/sw/XML/XMLBIN/share/www.oasis-open.org/docbook/xmldtd-4.2/docbookx.dtd" > 5 <book lang="en-gb"> <!-- This is a <huge>comment & --> <bookinfo> <title>XML rules the world!</title> 10 </bookinfo> <chapter id="Chap1"> <title>XML rules the world!</title> 15 <para>Here we go with DocBook and XML.</para> </chapter> </book>
This example shows how to place comments (line 5) in an XML source file. A comment is all material between a leading <!-- and a trailing -->. The textual material between these two markers cannot contain two consecutive hyphens, i.e., -- is disallowed inside comments. A comment can span several lines. Comments are not interpreted by XML parsers, i.e. as seen in the example, you can put markup and other forbidden characters inside comments without problems.
To convert a DocBook file from DocBook format to another format, you need an XML processing tools and an XSL style sheet. The command docbook2html uses internally Mike Kay's saxon XSLT interpreter and Norman Wlash' XSLT style sheets.