changeset 723:3c5e1c03cc3e

Add XSL stylesheets for DocBook
author Dongsheng Song <dongsheng.song@gmail.com>
date Thu, 12 Mar 2009 15:47:15 +0800
parents 082bb76417f1
children cfdb601a3c8b
files xsl/en/fo.xsl xsl/en/html-single.xsl xsl/en/html.xsl xsl/fo.xsl xsl/html-single.xsl xsl/html.xsl xsl/zh/fo.xsl xsl/zh/html-single.xsl xsl/zh/html.xsl
diffstat 9 files changed, 211 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsl/en/fo.xsl	Thu Mar 12 15:47:15 2009 +0800
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                version='1.0'>
+
+  <xsl:import href="../fo.xsl"/>
+
+  <xsl:param name="l10n.gentext.language" select="'en'"/>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsl/en/html-single.xsl	Thu Mar 12 15:47:15 2009 +0800
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+  <xsl:import href="../html-single.xsl"/>
+
+  <xsl:param name="l10n.gentext.language" select="'en'"/>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsl/en/html.xsl	Thu Mar 12 15:47:15 2009 +0800
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+  <xsl:import href="../html.xsl"/>
+
+  <xsl:param name="l10n.gentext.language" select="'en'"/>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsl/fo.xsl	Thu Mar 12 15:47:15 2009 +0800
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
+
+  <xsl:param name="draft.mode" select="no"/>
+
+  <!-- These extensions are required for table printing and other stuff -->
+  <xsl:param name="use.extensions">1</xsl:param>
+  <xsl:param name="callouts.extension">1</xsl:param>
+  <xsl:param name="linenumbering.extension">1</xsl:param>
+  <xsl:param name="tablecolumns.extension">1</xsl:param>
+  <xsl:param name="textinsert.extension">1</xsl:param>
+
+  <xsl:param name="admon.graphics" select="1" />
+  <xsl:param name="admon.graphics.extension">.png</xsl:param>
+  <xsl:param name="callout.graphics" select="1" />
+  <xsl:param name="callout.graphics.extension">.png</xsl:param>
+
+  <xsl:param name="section.autolabel" select="1" />
+  <xsl:param name="section.label.includes.component.label">1</xsl:param>
+
+  <xsl:param name="variablelist.as.blocks" select="1" />        <!-- fo only -->
+  <xsl:param name="hyphenate">false</xsl:param>                 <!-- fo only -->
+  <xsl:param name="paper.type" select="'A4'"></xsl:param>       <!-- fo only -->
+
+  <!-- Default font settings -->
+  <!--
+  <xsl:param name="title.font.family">sans-serif</xsl:param>
+  <xsl:param name="body.font.family">serif</xsl:param>
+  <xsl:param name="sans.font.family">sans-serif</xsl:param>
+  <xsl:param name="dingbat.font.family">serif</xsl:param>
+  <xsl:param name="monospace.font.family">monospace</xsl:param>
+  <xsl:param name="symbol.font.family">Symbol,ZapfDingbats</xsl:param>
+  -->
+
+  <!-- Custom font settings - preferred truetype font -->
+  <xsl:param name="title.font.family">Calibri,sans-serif,SimHei</xsl:param>
+  <xsl:param name="body.font.family">Cambria,Cambria Math,serif,SimSun</xsl:param>
+  <xsl:param name="sans.font.family">Calibri,sans-serif,SimHei</xsl:param>
+  <xsl:param name="dingbat.font.family">Cambria,Cambria Math,serif,SimSun</xsl:param>
+  <xsl:param name="monospace.font.family">Courier New,monospace,FangSong</xsl:param>
+
+  <!-- Page related Settings -->
+  <xsl:param name="page.margin.inner">1.5cm</xsl:param>
+  <xsl:param name="page.margin.outer">1.5cm</xsl:param>
+  <xsl:param name="title.margin.left">0pt</xsl:param>
+  <xsl:param name="body.start.indent">24pt</xsl:param>
+  <xsl:param name="body.end.indent">0pt</xsl:param>
+
+  <!-- Breaking long lines -->
+  <xsl:param name="hyphenate.verbatim">1</xsl:param>
+  <xsl:attribute-set name="monospace.verbatim.properties"
+                     use-attribute-sets="verbatim.properties monospace.properties">
+    <xsl:attribute name="wrap-option">wrap</xsl:attribute>
+    <xsl:attribute name="hyphenation-character">&#x25BA;</xsl:attribute>
+  </xsl:attribute-set>
+
+  <!-- Prevent blank pages in output -->
+  <xsl:template name="book.titlepage.before.verso">
+  </xsl:template>
+  <xsl:template name="book.titlepage.verso">
+  </xsl:template>
+  <xsl:template name="book.titlepage.separator">
+  </xsl:template>
+
+  <!-- Colourize links in output -->
+  <xsl:attribute-set name="xref.properties">
+    <xsl:attribute name="color">
+      <xsl:choose>
+        <xsl:when test="self::ulink">blue</xsl:when>
+        <xsl:when test="self::xref">blue</xsl:when>
+        <xsl:when test="self::uri">blue</xsl:when>
+        <xsl:otherwise>red</xsl:otherwise>
+      </xsl:choose>
+    </xsl:attribute>
+  </xsl:attribute-set>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsl/html-single.xsl	Thu Mar 12 15:47:15 2009 +0800
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
+
+  <xsl:param name="draft.mode" select="no"/>
+
+  <!-- xsltproc can't support these extensions
+  <xsl:param name="use.extensions">1</xsl:param>
+  <xsl:param name="callouts.extension">1</xsl:param>
+  <xsl:param name="linenumbering.extension">1</xsl:param>
+  <xsl:param name="tablecolumns.extension">1</xsl:param>
+  <xsl:param name="textinsert.extension">1</xsl:param>
+  -->
+
+  <xsl:param name="admon.graphics" select="1" />
+  <xsl:param name="admon.graphics.extension">.png</xsl:param>
+  <xsl:param name="callout.graphics" select="1" />
+  <xsl:param name="callout.graphics.extension">.png</xsl:param>
+
+  <xsl:param name="section.autolabel" select="1" />
+  <xsl:param name="section.label.includes.component.label">1</xsl:param>
+
+  <xsl:output method="html" encoding="utf-8" indent="yes"/>     <!-- html only -->
+  <xsl:param name="use.id.as.filename">0</xsl:param>            <!-- html only -->
+  <xsl:param name="chunk.section.depth">0</xsl:param>           <!-- html only -->
+  <xsl:param name="chunker.output.indent">yes</xsl:param>       <!-- html only -->
+  <xsl:param name="html.stylesheet">hgbook.css</xsl:param>      <!-- html only -->
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsl/html.xsl	Thu Mar 12 15:47:15 2009 +0800
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
+
+  <xsl:param name="draft.mode" select="no"/>
+
+  <!-- xsltproc can't support these extensions
+  <xsl:param name="use.extensions">1</xsl:param>
+  <xsl:param name="callouts.extension">1</xsl:param>
+  <xsl:param name="linenumbering.extension">1</xsl:param>
+  <xsl:param name="tablecolumns.extension">1</xsl:param>
+  <xsl:param name="textinsert.extension">1</xsl:param>
+  -->
+
+  <xsl:param name="admon.graphics" select="1" />
+  <xsl:param name="admon.graphics.extension">.png</xsl:param>
+  <xsl:param name="callout.graphics" select="1" />
+  <xsl:param name="callout.graphics.extension">.png</xsl:param>
+
+  <xsl:param name="section.autolabel" select="1" />
+  <xsl:param name="section.label.includes.component.label">1</xsl:param>
+
+  <xsl:output method="html" encoding="utf-8" indent="yes"/>     <!-- html only -->
+  <xsl:param name="use.id.as.filename">0</xsl:param>            <!-- html only -->
+  <xsl:param name="chunk.section.depth">0</xsl:param>           <!-- html only -->
+  <xsl:param name="chunker.output.indent">yes</xsl:param>       <!-- html only -->
+  <xsl:param name="html.stylesheet">hgbook.css</xsl:param>      <!-- html only -->
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsl/zh/fo.xsl	Thu Mar 12 15:47:15 2009 +0800
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                version='1.0'>
+
+  <xsl:import href="../fo.xsl"/>
+
+  <xsl:param name="l10n.gentext.language" select="'zh'"/>
+
+  <!-- Chinese font related settings -->
+  <xsl:param name="body.font.master">12</xsl:param>
+
+  <xsl:attribute-set name="standard.para.spacing" use-attribute-sets="normal.para.spacing">
+    <xsl:attribute name="text-indent">24pt</xsl:attribute>
+  </xsl:attribute-set>
+
+  <xsl:template match="abstract/para|appendix/para|chapter/para|colophon/para|legalnotice/para|preface/para|section/para|sect1/para|sect2/para">
+    <fo:block xsl:use-attribute-sets="standard.para.spacing">
+      <xsl:call-template name="anchor"/>
+      <xsl:apply-templates/>
+    </fo:block>
+  </xsl:template>
+
+  <xsl:template match="section/para/*">
+    <fo:wrapper text-indent="0pt">
+      <xsl:apply-imports/>
+    </fo:wrapper>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsl/zh/html-single.xsl	Thu Mar 12 15:47:15 2009 +0800
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+  <xsl:import href="../html-single.xsl"/>
+
+  <xsl:param name="l10n.gentext.language" select="'zh'"/>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsl/zh/html.xsl	Thu Mar 12 15:47:15 2009 +0800
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+  <xsl:import href="../html.xsl"/>
+
+  <xsl:param name="l10n.gentext.language" select="'zh'"/>
+
+</xsl:stylesheet>