Installation Configuration Docbook Tool

xiaoxiao2021-03-06  37

Use the DocBook release document, you need to install the following tools: * Docbook DTD * DocBook XSL Style * XSLT Handling * XSL-FO handler

The installation of each tool is described in detail below.

1. Install DocBook DTD

Docbook DTD can download on the Oasis website where you can find a compressed package in the zip format. The current latest version is 4.2.

In fact, you can download Docbook DTD. If your document DTD declares this:

Based on such definitions, most of the XML processors can acquire DTD from the network. The benefits of doing this are the edited DocBook document portability, which can be used on a machine where the Docbook DTD is installed. However, since the DocBook DTD is relatively large, it will affect the processing speed through the network, which affects the processing speed. In the case of a low speed network or the network, the effect is particularly significant.

If you choose to use a local DTD, the DTD reference of the document should write this:

Linux:

Windows:

Docbook provides a way to allow users to use the same DTD declaration, but can get DTDs with the network and switch between the local DTDs while having the advantages of both. This is the role of the Catalog file. Typical Catalog declarations are as follows:

This statement maps the network DTD to the local DTD. If you use the XSLT Processor that supports Catalog, it will first look for a local file, and if the local file does not exist, find the network.

2. Install the DocBook XSL style sheet

On http://docbook.sourceforge.net, you can download to the Docbook XSL style sheet, and the latest version is 1.67.2.

After decompression, there are several main directories: * Common - the public module, such as language, such as language, is here. * Extensions - extended code written for specific XSLT Processors. * Fo - Generates the XSL style sheet required for the XSL-FO file. * HTML - Generate the XSL style sheet required for the HTML file. * Images - Image required to generate a document. * DOC - Document on the XSL style list is also the Docbook document.

Others have a directory like HTMLHELP, but not to generate HTML or XSL-FO. 3. Install XSLT Processor

There are currently many free XSLT Processors, most commonly used * Saxon - use Java implementation, http: //saxon.sourceforge.net/. * Xalan - There are Java and C versions, http://xml.apache.org/xalan-j/index.html. * Xsltproc - Using C is implemented, it is the fastest handler, http: //xmlsoft.org/xslt/ Because Saxon and Xala have Java version, it can be installed in accordance with the general Java program installation. The following describes the installation of XSLTProc because it is fast, which is my favorite handler.

If you use the Windows platform, then you have two ways to choose:

1) Download the version pre-compiled as a Windows platform. You need to download libXML, LibxSLT, and ICONV, which are all Zip formats, decompressed, add the xsltproc.exe and .dll files in the environment variable Path. If you don't want to edit environment variables, a simple way is to copy the following files to c: / windows / system32: libxslt.dll libxml2.dll libexslt.dll iconv.dll xsltproc.exe

This can be found directly in the command line. After completing, run the XSLTProc -Version printing the publication, indicating that the installation is complete. 2) Install under Cygwin, which is what I choose to use. Cygwin is an application that simulates Linux shell under Windows. If you like to use xsltproc in a Linux command, download the Cygwin installer. Cygwin is installed over the network. First you select libxSLT from the package list it provides, then the installer automatically selects libXML2 based on the dependency, after the confirmation, the installer downloads and installs XSLTProc. After the installation, you can run xsltproc -version to check if the installation is successful. 3) If you use Linux, you are very likely that the system has already installed XSLTPROC. Check if Xsltproc -Version checks if it is already installed. If the running command fails, or the version is too old, then the following two URL get the latest RPM package: http://rpmfind.net/linux/rpm2html/search.php? Query = libxml2http://rpmfind.net/linux/ RPM2HTML / SEARCH.PHP? Query = LIBXSLT

Then switch to root permissions, install new packages: rpm -uv libxml2-2.6.17-2.i386.rpmrpm -uv libxslt-1.1.12-4.i386.rpm

After completing, you can run xsltproc -version to check if the installation is complete.

After installation, xsltproc can be used to generate HTML or XSL-FO files.

For example, generate html: xsltproc --output myfile.html docbook-xsl / html / docbook.xsl myfile.xml

Or generate xsl-fo documentation: xsltproc --output myfile.fo docbook-xsl / fo / docbook.xsl myfile.xml

List all XSLTPROC command line parameters on http://xmlsoft.org/xslt/xsltproc2.html, running Xsltproc directly, the parameter list will be printed. If you only have an HTML document, then it will be. If you want to post a PDF or a PS document, you need to install the XSL-FO handler.

4. Install the XSL-FO handler

The XSL-FO handler generates a PDF or PS file based on the XSL-FO file generated by the XSLT handler. The currently available XSL-FO handler is much better than the XSLT handler, because: a. XSL-FO standard is two years later than the XSLT standard; B.XSL-FO standard and its huge and complicated, The standard authors also discovered its difficulty to achieve this standard into basic, expanded, and complete three levels.

Free XSL-FO handles available now:

* FOP - from the Apache XML project. The latest version is 0.20.5, still in development, and many features are not supported, but the general use can be met. * Passivetex - From Sebastian Rahtz (http://www.tei-c.org.uk/software/passivetex/) a TEX-based XSL-FO handler. Also in development, more FOP is more complicated.

In addition, there are some commercial products to choose from, and the quality of the document that may be generated is better than the open source code, such as:

* XEP

* XSL Formatter

Here is how to install FOP.

4.1. First, you need to install JDK, this is not to say more.

4.2. Download FOP, you can choose TAR or ZIP compression packets. After downloading, decompress it locally.

4.3. Download the Graphics Code Base. FOP does not support pictures such as PNG, and if you tend to image in your document, you need to download an additional code base. You can choose JAI, or JIMI. The version before 0.20.5 can only use Jimi. After downloading, copy jai_core.jar and jai_codec.jar (jai), or Jimiproclasses.jar (JIMI) to the lib directory of the FOP installation directory, then add it in the FOP.BAT (Windows Platform)

set LOCALCLASSPATH =% LOCALCLASSPATH%;% LIBDIR% / jai_core.jarset LOCALCLASSPATH =% LOCALCLASSPATH%;% LIBDIR% / jai_codec.jar or set LOCALCLASSPATH =% LOCALCLASSPATH%;% LIBDIR% / JimiProClasses.zip

If you use a FOP.SH (Linux platform), you will automatically search.

4.4. Add an extension code. If the DocBook XSL style is single with extension code for the FOP (currently not), add them to the FOP installation directory like the LIB directory.

You can now use FOP to generate a PDF document. FOP provides two scripts FOP.BAT (Windows Platform) and FOP.SH (UNIX, and Linux platforms) for easy use. The command line of the generated PDF is as follows: Linux or UNIX: FOP.SH -XSL /DOCBOOK-XSL /FO/Docbook.xsl -xml myfile.xml -pdf myfile.pdf Windows: Fop.Bat -xsl / DocBook-XSL / FO / Docbook.xsl -xml myfile.xml -pdf myfile.pdf

In the process of processing, some attributes may be prompted or have not been implemented, and these prompts are not intended, because the FOP is still in development, which does not affect the generation of PDF documents. At this point, a Docbook release system configuration is complete, and can be used to publish a document. You can write tasks on Linux and automatically publish technical documents through this system.

转载请注明原文地址:https://www.9cbs.com/read-57552.html

New Post(0)