hello world

Programmer Tue

统计

留言簿(1)

Related Links

阅读排行榜

评论排行榜

DocBook, DocBook XSL and xsltproc

Customization of the stylesheet:

 1<?xml version='1.0'?>
 2 
 3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 4 
 5   <xsl:import href="xhtml/docbook.xsl"/>
 6   <xsl:param name="html.stylesheet" select="'style.css'"/>
 7   
 8   <!--xsl:param name="generate.toc">
 9     appendix  nop
10     article   toc,title
11     book      toc,title,figure,table,example,equation
12     chapter   toc
13     part      nop
14     preface   nop
15     qandadiv  nop
16     qandaset  nop
17     reference toc,title
18     section   nop
19     set       toc
20   </xsl:param-->
21   
22   <xsl:param name="generate.toc">
23     appendix  nop
24     article   nop
25     book      nop
26     chapter   nop
27     part      nop
28     preface   nop
29     qandadiv  nop
30     qandaset  nop
31     reference nop
32     section   nop
33     set       nop
34   </xsl:param>
35   
36   <xsl:template name="user.header.navigation">
37     <font color="red">user.header.navigation</font>
38   </xsl:template>
39   
40   <xsl:template name="user.header.content">
41     <font color="red">user.header.content</font>
42   </xsl:template>
43   
44   <xsl:template name="user.footer.content">
45     <font color="red">user.footer.content</font>
46   </xsl:template>
47   
48   <xsl:template name="user.footer.navigation">
49     <hr />
50     <font color="red">user.footer.navigation</font>
51     <hr />
52   </xsl:template>
53   
54 </xsl:stylesheet>


A sample docbook article:

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
 3                   "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
 4 
 5 <article lang="zh-CN">
 6   <title>The title of the article</title>
 7   <articleinfo>
 8     <author>
 9       <firstname>Zhong</firstname>
10       <surname>ZHENG</surname>
11     </author>
12     <date>July 05, 2006</date>
13   </articleinfo>
14   <para>This is a paragraph.</para>
15   <para>This is another paragraph.</para>
16   <section id="sect1">
17     <title>The title of a section</title>
18     <subtitle>It even has a subtitle</subtitle>
19     <para>The paragraph of the section.</para>
20   </section>
21 </article>

To generate HTML output, use the following commands:

set SGML_CATALOG_FILES=path/to/catalog.xml
xsltproc --catalogs --output path/to/generated/output.html path/to/customization.xsl path/to/docbook/source.xml

posted on 2006-07-03 20:13 ZHENG Zhong 阅读(561) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理