Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1

(^64) CHAPTER 6 ■ DOCUMENTATION AND CODING CONVENTIONS
apt-get install docbook docbook-xsl docbook-xml xsltproc
There are a lot of other DocBook-related subpackages, but these are the three packages
you’ll need to get started: DocBook XSL, DocBook XML, and the xsltproc tool.
Next, to parse your file, you will need to locate the docbook.xsl XSL stylesheet that you are
going to use to transform your DocBook file. The file location depends on your distribution.
The Debian default location is as follows:
/usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl
If the docbook.xsl file is not at this exact location, it will be close by. You will need to know
the actual full path to this file to transform your document.
Next, execute the xsltproc program to transform your document according to the XSL
stylesheet, like so:
xsltproc /path/to/docbook.xsl yourfile.xml
After running this command, you will also see some HTML output. This is the resultant
form of DocBook processing, but it isn’t very useful on the command line. To make it useful,
you need to send it to a file, like so:
xsltproc -o yourfile.html /path/to/docbook.xsl yourfile.xml
You will now find yourfile.html in the directory, and you won’t see the HTML on the
command line; that HTML data is now in the file. You can open this file in a web browser,
and voilà, instant manual! Figure 6-1 shows an example.
Figure 6-1. Sample DocBook documentation in yourfile.html
McArthur_819-9C06.fm Page 64 Friday, February 22, 2008 8:59 AM

Free download pdf