Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 | 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

4.7. Docbook HTML 輸出選項

HTML output options

4.7.1. 指定多頁輸出時html文檔名

		
我們把docbook文檔轉換成html文檔時,可以轉換成一個大的html文檔,也可以轉換成多頁的html文檔。當轉換成多頁是,預設的檔案是以ch01.html、ch02.html方式命名的,較不直觀。我們可在docbook文檔中添加一個屬性,使它輸出時按我們指定的檔案名輸出。

方法一:
<chapter><?dbhtml filename="first.html" ?>
<title>Introduction</title>
...
		
		
		
方法二:
<chapter id="first">
<title>Introduction</title>
...

xsltproc --stringparam  use.id.as.filename 1 chunk.xsl myfile.xml
		
		

4.7.2. 指定輸出路徑

		
預設轉換後的文檔是保存在當前目錄的,我們可在xsltproc命令行用-o選項指定轉換後文檔的輸出路徑,另外一種是在docbook中指定。

<book><?dbhtml dir="neo" ?>
<title>Docbook Guide</title>
...
<chapter id="first"><?dbhtml dir="technic" ?>
...
<chapter id="second">
...
<appendix id="three"><?dbhtml dir="read" ?>
...

輸出後的路徑:
jims/index.html
jims/technic/first.html
jims/second.html
jims/read/three.html
		
		

4.7.3. 包含HTML檔案

		
...
</para>
<?dbhtml-include href="mycode.html"?>
<?dbhtml-include href="../additonal.html"?>
<para>
...
		
		

4.7.4. 包含HTML節點

		
<xsl:template name="user.header.content">
   <xsl:variable name="codefile" select="document('mycode.html',/)"/>
   <xsl:copy-of select="$codefile/htmlcode/node()"/>
</xsl:template>
		
		

4.7.5. 表徵圖

Docbook icon graphics

4.7.5.1. Admonition graphics

admon.graphics 1

xsltproc  --stringparam admon.graphics 1 docbook.xsl myfile.xml
			

4.7.5.2. 導航表徵圖

Navigational icons
xsltproc --stringparam  navig.graphics 1  chunk.xsl  myfile.xml
			

4.7.5.3. Callout icons

If you use callout graphics, then there are three parameters that give you more control over the generated img tag.

callout.graphics.extension
Use this parameter to change the icon file extension from .png to something else. Of course, you must have the graphics that match that extension.

callout.graphics.path
Use this parameter to change the generated directory name from the default images/callouts/. Be sure to include the trailing slash.

callout.graphics.number.limit
Use this parameter to set the highest number for which you have a callout graphic. The stylesheets are distributed with callout graphics files with numbers up to 15, but you could create graphics with additional numbers if you need them. If you have more numbers but you do not reset this parameter, then any numbers over 15 will still format like (16).
			

4.7.6. dbhtml-include

包含html檔案到當前頁面

		
<?dbhtml-include href="file:///www/freebsd/faq.html"?>
<?dbhtml-include href="http://www.example.org/freebsd/faq.html"?>
		
		

注意:需要開啟下面兩個選項才能生效

		
	<xsl:param name="use.extensions" select="1"/>
	<xsl:param name="textinsert.extension" select="1"/>
		
		

4.7.7. 顯示當前時間

		
<para>This document was generated <?dbtimestamp format="Y-m-d H:M:S"?>. </para>
		
		
		
<?dbtimestamp format="Y-m-d"  padding="0" ?>