![hide](/docbook/includes/images/freemind/hide.png)
SGML/XML 标记语言基础
![hide](/docbook/includes/images/freemind/hide.png)
SGML 的特征
![hide](/docbook/includes/images/freemind/hide.png)
文档结构
![hide](/docbook/includes/images/freemind/hide.png)
如何将文章分解成几块
(利用外部实体)
(利用外部实体)
![hide](/docbook/includes/images/freemind/hide.png)
Catalog 文件
![leaf](/docbook/includes/images/freemind/leaf.png)
The catalog file format was defined in 1994 by SGML Open (now OASIS). The formal specification is contained in OASIS Technical Resolution 9401:1997.
![hide](/docbook/includes/images/freemind/hide.png)
SGML 格式的 Catalog 文件
![hide](/docbook/includes/images/freemind/hide.png)
语法
![hide](/docbook/includes/images/freemind/hide.png)
对不同文档设置不同 SGMLDecl
![hide](/docbook/includes/images/freemind/hide.png)
如: 在一个 catalog 文件中既定义 DTD 的
声明文件,又定义XML的声明文件
声明文件,又定义XML的声明文件
![leaf](/docbook/includes/images/freemind/leaf.png)
SGMLDECL "dtd/docbook-4.5/docbook.dcl"
DTDDECL "-//OASIS//DTD DocBook XML V4.5CR1//EN" "dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl"
DTDDECL "-//OASIS//DTD DocBook XML V4.2//EN" "dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl"
DTDDECL "-//OASIS//DTD DocBook XML V3.1//EN" "dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl"
DTDDECL "-//OASIS//DTD DocBook XML V4.5CR1//EN" "dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl"
DTDDECL "-//OASIS//DTD DocBook XML V4.2//EN" "dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl"
DTDDECL "-//OASIS//DTD DocBook XML V3.1//EN" "dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl"
![hide](/docbook/includes/images/freemind/hide.png)
示例
![leaf](/docbook/includes/images/freemind/leaf.png)
-- Comments are delimited by pairs of double-hyphens,
as in SGML and XML comments. --
OVERRIDE YES
SGMLDECL "n:/share/sgml/docbook/3.1/docbook.dcl"
DOCTYPE BOOK n:/share/sgml/docbook/3.1/docbook.dtd
PUBLIC "-//OASIS//DTD DocBook V3.1//EN"
n:/share/sgml/docbook/3.1/docbook.dtd
SYSTEM "http://nwalsh.com/docbook/xml/1.3/db3xml.dtd"
n:/share/sgml/Norman_Walsh/db3xml/db3xml.dtd
as in SGML and XML comments. --
OVERRIDE YES
SGMLDECL "n:/share/sgml/docbook/3.1/docbook.dcl"
DOCTYPE BOOK n:/share/sgml/docbook/3.1/docbook.dtd
PUBLIC "-//OASIS//DTD DocBook V3.1//EN"
n:/share/sgml/docbook/3.1/docbook.dtd
SYSTEM "http://nwalsh.com/docbook/xml/1.3/db3xml.dtd"
n:/share/sgml/Norman_Walsh/db3xml/db3xml.dtd
![hide](/docbook/includes/images/freemind/hide.png)
XML格式的 Catalog 文件
![hide](/docbook/includes/images/freemind/hide.png)
语法
![hide](/docbook/includes/images/freemind/hide.png)
public/system 定位 DTD 位置
![leaf](/docbook/includes/images/freemind/leaf.png)
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<group prefer="public" xml:base="file:///usr/share/xml/" >
<public
publicId="-//OASIS//DTD DocBook XML V4.4//EN"
uri="docbook44/docbookx.dtd"/>
<system
systemId="http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
uri="docbook44/docbookx.dtd"/>
<system
systemId="docbook4.4.dtd"
uri="docbook44/docbookx.dtd"/>
</group>
</catalog>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<group prefer="public" xml:base="file:///usr/share/xml/" >
<public
publicId="-//OASIS//DTD DocBook XML V4.4//EN"
uri="docbook44/docbookx.dtd"/>
<system
systemId="http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
uri="docbook44/docbookx.dtd"/>
<system
systemId="docbook4.4.dtd"
uri="docbook44/docbookx.dtd"/>
</group>
</catalog>
![hide](/docbook/includes/images/freemind/hide.png)
uri 定位 XSL 样式表位置
(本地到本地)
(本地到本地)
![leaf](/docbook/includes/images/freemind/leaf.png)
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri
name="docbook.xsl"
uri="file:///usr/share/xml/docbook-xsl-1.68.1/html/docbook.xsl"/>
</catalog>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri
name="docbook.xsl"
uri="file:///usr/share/xml/docbook-xsl-1.68.1/html/docbook.xsl"/>
</catalog>
![hide](/docbook/includes/images/freemind/hide.png)
uri 将 web 地址对应本地文件
(URL 到本地)
(URL 到本地)
![leaf](/docbook/includes/images/freemind/leaf.png)
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<system
systemId="http://www.oasis-open.org/docbook/xml/4.4/"
uri="file:///usr/share/xml/docbook44/" />
<uri
name="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"
uri="file:///usr/share/xml/docbook-xsl-1.68.1/html/docbook.xsl" />
<uri
name="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"
uri="file:///usr/share/xml/docbook-xsl-1.68.1/html/chunk.xsl" />
</catalog>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<system
systemId="http://www.oasis-open.org/docbook/xml/4.4/"
uri="file:///usr/share/xml/docbook44/" />
<uri
name="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"
uri="file:///usr/share/xml/docbook-xsl-1.68.1/html/docbook.xsl" />
<uri
name="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"
uri="file:///usr/share/xml/docbook-xsl-1.68.1/html/chunk.xsl" />
</catalog>
![hide](/docbook/includes/images/freemind/hide.png)
rewriteSystem 建立重写规则,
简化、合并 URI 项
简化、合并 URI 项
![leaf](/docbook/includes/images/freemind/leaf.png)
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteSystem
systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4/"
rewritePrefix="file:///usr/share/xml/docbook44/" />
<rewriteURI
uriStartString="http://docbook.sourceforge.net/release/xsl/current/"
rewritePrefix="file:///usr/share/xml/docbook-xsl-1.68.1/" />
</catalog>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteSystem
systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4/"
rewritePrefix="file:///usr/share/xml/docbook44/" />
<rewriteURI
uriStartString="http://docbook.sourceforge.net/release/xsl/current/"
rewritePrefix="file:///usr/share/xml/docbook-xsl-1.68.1/" />
</catalog>
![hide](/docbook/includes/images/freemind/hide.png)
SGML 时代的 DocBook
![hide](/docbook/includes/images/freemind/hide.png)
OpenSP
![hide](/docbook/includes/images/freemind/hide.png)
编译 OpenSP 之前
![hide](/docbook/includes/images/freemind/hide.png)
OpenSP 补丁
![hide](/docbook/includes/images/freemind/hide.png)
isSgmlChar
![leaf](/docbook/includes/images/freemind/leaf.png)
文件: include/Syntax.h
diff -r -u OpenSP-1.5.1/include/Syntax.h OpenSP-1.5.1-new/include/Syntax.h
--- OpenSP-1.5.1/include/Syntax.h 2005-12-18 10:38:50.890625000 +0800
+++ OpenSP-1.5.1-new/include/Syntax.h 2005-12-18 10:44:20.703125000 +0800
@@ -389,7 +389,7 @@
inline Boolean Syntax::isSgmlChar(Xchar c) const
{
- return c >= 0 && set_[sgmlChar].contains(Char(c));
+ return c >= 256 || c >= 0 && set_[sgmlChar].contains(Char(c));
}
inline const StringC &Syntax::reservedName(ReservedName i) const
diff -r -u OpenSP-1.5.1/include/Syntax.h OpenSP-1.5.1-new/include/Syntax.h
--- OpenSP-1.5.1/include/Syntax.h 2005-12-18 10:38:50.890625000 +0800
+++ OpenSP-1.5.1-new/include/Syntax.h 2005-12-18 10:44:20.703125000 +0800
@@ -389,7 +389,7 @@
inline Boolean Syntax::isSgmlChar(Xchar c) const
{
- return c >= 0 && set_[sgmlChar].contains(Char(c));
+ return c >= 256 || c >= 0 && set_[sgmlChar].contains(Char(c));
}
inline const StringC &Syntax::reservedName(ReservedName i) const
![hide](/docbook/includes/images/freemind/hide.png)
允许中文注释
![leaf](/docbook/includes/images/freemind/leaf.png)
文件: lib/parseCommon.cxx
diff -r -u OpenSP-1.5.1/lib/parseCommon.cxx OpenSP-1.5.1-new/lib/parseCommon.cxx
--- OpenSP-1.5.1/lib/parseCommon.cxx 1999-11-04 16:36:13.000000000 +0800
+++ OpenSP-1.5.1-new/lib/parseCommon.cxx 2005-12-18 10:46:41.781250000 +0800
@@ -541,14 +541,12 @@
Token token;
while ((token = getToken(mode)) != tokenCom)
switch (token) {
- case tokenUnrecognized:
- if (!reportNonSgmlCharacter())
- message(ParserMessages::sdCommentSignificant,
- StringMessageArg(currentToken()));
- break;
case tokenEe:
message(ParserMessages::commentEntityEnd, startLoc);
return 0;
+ case tokenUnrecognized:
+ if (reportNonSgmlCharacter())
+ break;
default:
if (markup)
markup->addCommentChar(currentChar());
diff -r -u OpenSP-1.5.1/lib/parseCommon.cxx OpenSP-1.5.1-new/lib/parseCommon.cxx
--- OpenSP-1.5.1/lib/parseCommon.cxx 1999-11-04 16:36:13.000000000 +0800
+++ OpenSP-1.5.1-new/lib/parseCommon.cxx 2005-12-18 10:46:41.781250000 +0800
@@ -541,14 +541,12 @@
Token token;
while ((token = getToken(mode)) != tokenCom)
switch (token) {
- case tokenUnrecognized:
- if (!reportNonSgmlCharacter())
- message(ParserMessages::sdCommentSignificant,
- StringMessageArg(currentToken()));
- break;
case tokenEe:
message(ParserMessages::commentEntityEnd, startLoc);
return 0;
+ case tokenUnrecognized:
+ if (reportNonSgmlCharacter())
+ break;
default:
if (markup)
markup->addCommentChar(currentChar());
![hide](/docbook/includes/images/freemind/hide.png)
catalog
![leaf](/docbook/includes/images/freemind/leaf.png)
SGMLDECL "/home/JiangXin/work/docbook/dtd/4.5/docbook.dcl"
CATALOG "/home/JiangXin/work/docbook/dtd/4.5/docbook.cat"
DOCTYPE book /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE article /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE chapter /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
CATALOG "/home/JiangXin/work/docbook/dtd/4.5/docbook.cat"
DOCTYPE book /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE article /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE chapter /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
![hide](/docbook/includes/images/freemind/hide.png)
应用
![hide](/docbook/includes/images/freemind/hide.png)
准备
![hide](/docbook/includes/images/freemind/hide.png)
创建一个 catalog 文件
![hide](/docbook/includes/images/freemind/hide.png)
catalog 文件
![leaf](/docbook/includes/images/freemind/leaf.png)
DOCTYPE book /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE article /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE chapter /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE article /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE chapter /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
![hide](/docbook/includes/images/freemind/hide.png)
示例
![leaf](/docbook/includes/images/freemind/leaf.png)
-- ...................................................................... --
-- "export SGML_CATALOG_FILES=/PATH/catalog" --
OVERRIDE YES
SGMLDECL "/home/JiangXin/work/docbook/dtd/4.5/docbook.dcl"
CATALOG "/home/JiangXin/work/docbook/dtd/4.5/docbook.cat"
CATALOG "/home/JiangXin/work/docbook/style/dsssl-1.79/catalog"
-- CATALOG "dtd/openjade/catalog" --
-- CATALOG "/home/JiangXin/work/docbook/dtd/entities/catalog.sgml" --
DOCTYPE book /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE article /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE chapter /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
-- "export SGML_CATALOG_FILES=/PATH/catalog" --
OVERRIDE YES
SGMLDECL "/home/JiangXin/work/docbook/dtd/4.5/docbook.dcl"
CATALOG "/home/JiangXin/work/docbook/dtd/4.5/docbook.cat"
CATALOG "/home/JiangXin/work/docbook/style/dsssl-1.79/catalog"
-- CATALOG "dtd/openjade/catalog" --
-- CATALOG "/home/JiangXin/work/docbook/dtd/entities/catalog.sgml" --
DOCTYPE book /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE article /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
DOCTYPE chapter /home/JiangXin/work/docbook/dtd/4.5/docbook.dtd
![hide](/docbook/includes/images/freemind/hide.png)
docbook.dcl 补丁
![hide](/docbook/includes/images/freemind/hide.png)
- LCNMCHAR ".-_"
- UCNMCHAR ".-_"
+ LCNMCHAR ".-_:"
+ UCNMCHAR ".-_:"
- UCNMCHAR ".-_"
+ LCNMCHAR ".-_:"
+ UCNMCHAR ".-_:"
![hide](/docbook/includes/images/freemind/hide.png)
否则:
onsgmls:/home/JiangXin/work/docbook/dtd/4.5/htmltblx.mod:102:9:E: character ":"
invalid: only "CDATA", "ENTITIES", "ENTITY", "ID", "IDREF", "IDREFS", "NAME", "N
AMES", "NMTOKEN", "NMTOKENS", "NOTATION", "NUMBER", "NUMBERS", "NUTOKEN", "NUTOK
ENS" and parameter separators allowed
onsgmls:/home/JiangXin/work/docbook/dtd/4.5/htmltblx.mod:110:9:E: character ":"
invalid: only "CDATA", "ENTITIES", "ENTITY", "ID", "IDREF", "IDREFS", "NAME", "N
AMES", "NMTOKEN", "NMTOKENS", "NOTATION", "NUMBER", "NUMBERS", "NUTOKEN", "NUTOK
ENS" and parameter separators allowed
onsgmls:/home/JiangXin/work/docbook/dtd/4.5/htmltblx.mod:102:9:E: character ":"
invalid: only "CDATA", "ENTITIES", "ENTITY", "ID", "IDREF", "IDREFS", "NAME", "N
AMES", "NMTOKEN", "NMTOKENS", "NOTATION", "NUMBER", "NUMBERS", "NUTOKEN", "NUTOK
ENS" and parameter separators allowed
onsgmls:/home/JiangXin/work/docbook/dtd/4.5/htmltblx.mod:110:9:E: character ":"
invalid: only "CDATA", "ENTITIES", "ENTITY", "ID", "IDREF", "IDREFS", "NAME", "N
AMES", "NMTOKEN", "NMTOKENS", "NOTATION", "NUMBER", "NUMBERS", "NUTOKEN", "NUTOK
ENS" and parameter separators allowed
![hide](/docbook/includes/images/freemind/hide.png)
OpenJade
![hide](/docbook/includes/images/freemind/hide.png)
编译 OpenJade
![hide](/docbook/includes/images/freemind/hide.png)
测试(参见 dsssl-doc 的例子)
![hide](/docbook/includes/images/freemind/hide.png)
测试 openjade:
![hide](/docbook/includes/images/freemind/hide.png)
可能出现的错误
![leaf](/docbook/includes/images/freemind/leaf.png)
openjade:jtest.dsl:1:72:W: cannot generate system identifier for public text "-//James Clark//DTD DSSSL Style Sheet//EN"
openjade:jtest.dsl:1:72:E: reference to entity "STYLE-SHEET" for which no system identifier could be generated
openjade:jtest.dsl:1:0: entity was defined here
openjade:E: specification document does not have the DSSSL architecture as a base architecture
openjade:jtest.dsl:1:72:E: reference to entity "STYLE-SHEET" for which no system identifier could be generated
openjade:jtest.dsl:1:0: entity was defined here
openjade:E: specification document does not have the DSSSL architecture as a base architecture
![hide](/docbook/includes/images/freemind/hide.png)
如何指定 DSSSL 样式表
![hide](/docbook/includes/images/freemind/hide.png)
一个DSSSL样式表文件可能包含
多个样式,如何指定?
多个样式,如何指定?
![hide](/docbook/includes/images/freemind/hide.png)
两种方式定义的多样式DSSSL文件
![hide](/docbook/includes/images/freemind/hide.png)
仅通过参数进行实体控制,
只包含一个 style-specification
只包含一个 style-specification
![leaf](/docbook/includes/images/freemind/leaf.png)
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY % html "IGNORE">
<![%html;[
<!ENTITY % print "IGNORE">
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA dsssl>
]]>
<!ENTITY % print "INCLUDE">
<![%print;[
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA dsssl>
]]>
]>
<style-sheet>
<style-specification use="docbook">
<style-specification-body>
;; common customization can go here
<![%print;[
;; customize the print stylesheet here
]]>
<![%html;[
;; customize the html stylesheet here
]]>
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="docbook.dsl">
</style-sheet>
<!ENTITY % html "IGNORE">
<![%html;[
<!ENTITY % print "IGNORE">
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA dsssl>
]]>
<!ENTITY % print "INCLUDE">
<![%print;[
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA dsssl>
]]>
]>
<style-sheet>
<style-specification use="docbook">
<style-specification-body>
;; common customization can go here
<![%print;[
;; customize the print stylesheet here
]]>
<![%html;[
;; customize the html stylesheet here
]]>
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="docbook.dsl">
</style-sheet>
![hide](/docbook/includes/images/freemind/hide.png)
不同的 style-specification 具有不同的 ID,
另外还有参数实体控制
另外还有参数实体控制
![leaf](/docbook/includes/images/freemind/leaf.png)
<!DOCTYPE style-sheet PUBLIC
"-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY % html "IGNORE">
<![%html;[
<!ENTITY % print "IGNORE">
<!ENTITY docbook.dsl PUBLIC
"-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN"
CDATA dsssl>
]]>
<!ENTITY % print "INCLUDE">
<![%print;[
<!ENTITY docbook.dsl PUBLIC
"-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"
CDATA dsssl>
]]>
]>
<style-sheet>
<style-specification id="print" use="docbook">
<style-specification-body>
;; customize the print stylesheet
...
</style-specification-body>
</style-specification>
<!--
;; customize the html stylesheet; parts borrowed from
;; Cygnus at http://sourceware.cygnus.com/ (cygnus-both.dsl)
-->
<style-specification id="html" use="docbook">
<style-specification-body>
... ...
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="docbook.dsl">
</style-sheet>
"-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY % html "IGNORE">
<![%html;[
<!ENTITY % print "IGNORE">
<!ENTITY docbook.dsl PUBLIC
"-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN"
CDATA dsssl>
]]>
<!ENTITY % print "INCLUDE">
<![%print;[
<!ENTITY docbook.dsl PUBLIC
"-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"
CDATA dsssl>
]]>
]>
<style-sheet>
<style-specification id="print" use="docbook">
<style-specification-body>
;; customize the print stylesheet
...
</style-specification-body>
</style-specification>
<!--
;; customize the html stylesheet; parts borrowed from
;; Cygnus at http://sourceware.cygnus.com/ (cygnus-both.dsl)
-->
<style-specification id="html" use="docbook">
<style-specification-body>
... ...
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="docbook.dsl">
</style-sheet>
![hide](/docbook/includes/images/freemind/hide.png)
格式转换
(命令行示例)
(命令行示例)
![hide](/docbook/includes/images/freemind/hide.png)
sgml -> single html
![hide](/docbook/includes/images/freemind/hide.png)
sgml -> multiple htmls
![hide](/docbook/includes/images/freemind/hide.png)
XML
![hide](/docbook/includes/images/freemind/hide.png)
xml -> single html
![hide](/docbook/includes/images/freemind/hide.png)
测试用例
![hide](/docbook/includes/images/freemind/hide.png)
test.sh
![leaf](/docbook/includes/images/freemind/leaf.png)
#!/bin/sh
SRCROOT=../../src
# onsgml test...
echo -ne "validate gb2312.sgml, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml gb2312.sgml
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "validate utf8.sgml, ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml utf8.sgml
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "validate gb2312.xml, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.xml
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "validate utf8.xml, ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl utf8.xml
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "gb2312.sgml is NOT valid IF VALIDATED AS XML, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.sgml 2>/dev/null
[ $? -ne 0 ] && echo "pass" || echo "failed"
# osx test...
echo -ne "osx convert test, gb2312.sgml->gb2312.xml, ... "
tmpfile=`mktemp tmp-gb-xml.XXXXX`
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 osx -x preserve-case -x comment -c ${SRCROOT}/catalog.sgml gb2312.sgml | iconv -f utf-8 -t gb2312 > $tmpfile
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl $tmpfile
[ -f $tmpfile ] && rm $tmpfile
echo "pass"
# openjade test...
echo -ne "convert gb2312.sgml to multiple htmls, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/html/docbook.dsl -t sgml gb2312.sgml
#rm t1.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert gb2312.sgml to one big html, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/html/docbook.dsl -V nochunks -t sgml gb2312.sgml > gb2312-sgml.htm
#rm index.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert gb2312.sgml to rtf, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/print/docbook.dsl -t rtf gb2312.sgml
#rm gb2312.rtf
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.sgml to multiple htmls (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#html -i html -i charset.utf8 -t sgml utf8.sgml
#rm t1.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.sgml to one big html (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#html -i html -i charset.utf8 -V nochunks -t sgml utf8.sgml > utf8-sgml.htm
#rm index.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.sgml to rtf (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#print -i print -t rtf utf8.sgml
#rm gb2312.rtf
[ $? -eq 0 ] && echo "pass" || echo "failed"
# openjade XML test...
echo -ne "convert gb2312.xml to multiple htmls, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/html/docbook.dsl -t sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.xml
#rm t1.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert gb2312.xml to one big html, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/html/docbook.dsl -V nochunks -t sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.xml > gb2312-sgml.htm
#rm index.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert gb2312.xml to rtf, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/print/docbook.dsl -t rtf ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.xml
#rm gb2312.rtf
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.xml to multiple htmls (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#html -i html -i charset.utf8 -t sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl utf8.xml
#rm t1.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.xml to one big html (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#html -i html -i charset.utf8 -V nochunks -t sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl utf8.xml > utf8-sgml.htm
#rm index.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.xml to rtf (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#print -i print -t rtf ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl utf8.xml
#rm gb2312.rtf
[ $? -eq 0 ] && echo "pass" || echo "failed"
SRCROOT=../../src
# onsgml test...
echo -ne "validate gb2312.sgml, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml gb2312.sgml
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "validate utf8.sgml, ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml utf8.sgml
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "validate gb2312.xml, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.xml
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "validate utf8.xml, ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl utf8.xml
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "gb2312.sgml is NOT valid IF VALIDATED AS XML, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.sgml 2>/dev/null
[ $? -ne 0 ] && echo "pass" || echo "failed"
# osx test...
echo -ne "osx convert test, gb2312.sgml->gb2312.xml, ... "
tmpfile=`mktemp tmp-gb-xml.XXXXX`
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 osx -x preserve-case -x comment -c ${SRCROOT}/catalog.sgml gb2312.sgml | iconv -f utf-8 -t gb2312 > $tmpfile
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 onsgmls -s -c ${SRCROOT}/catalog.sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl $tmpfile
[ -f $tmpfile ] && rm $tmpfile
echo "pass"
# openjade test...
echo -ne "convert gb2312.sgml to multiple htmls, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/html/docbook.dsl -t sgml gb2312.sgml
#rm t1.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert gb2312.sgml to one big html, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/html/docbook.dsl -V nochunks -t sgml gb2312.sgml > gb2312-sgml.htm
#rm index.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert gb2312.sgml to rtf, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/print/docbook.dsl -t rtf gb2312.sgml
#rm gb2312.rtf
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.sgml to multiple htmls (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#html -i html -i charset.utf8 -t sgml utf8.sgml
#rm t1.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.sgml to one big html (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#html -i html -i charset.utf8 -V nochunks -t sgml utf8.sgml > utf8-sgml.htm
#rm index.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.sgml to rtf (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#print -i print -t rtf utf8.sgml
#rm gb2312.rtf
[ $? -eq 0 ] && echo "pass" || echo "failed"
# openjade XML test...
echo -ne "convert gb2312.xml to multiple htmls, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/html/docbook.dsl -t sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.xml
#rm t1.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert gb2312.xml to one big html, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/html/docbook.dsl -V nochunks -t sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.xml > gb2312-sgml.htm
#rm index.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert gb2312.xml to rtf, ... "
SP_ENCODING=gb2312 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/docbook-dsssl-1.79/print/docbook.dsl -t rtf ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl gb2312.xml
#rm gb2312.rtf
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.xml to multiple htmls (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#html -i html -i charset.utf8 -t sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl utf8.xml
#rm t1.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.xml to one big html (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#html -i html -i charset.utf8 -V nochunks -t sgml ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl utf8.xml > utf8-sgml.htm
#rm index.htm
[ $? -eq 0 ] && echo "pass" || echo "failed"
echo -ne "convert utf8.xml to rtf (ldap.dsl), ... "
SP_ENCODING=utf-8 SP_CHARSET_FIXED=1 openjade -c ${SRCROOT}/catalog.sgml -d ${SRCROOT}/dsssl/ldp.dsl\#print -i print -t rtf ${SRCROOT}/dsssl/docbook-dsssl-1.79/dtds/decls/xml.dcl utf8.xml
#rm gb2312.rtf
[ $? -eq 0 ] && echo "pass" || echo "failed"
![hide](/docbook/includes/images/freemind/hide.png)
XML 时代的 DocBook
![hide](/docbook/includes/images/freemind/hide.png)
XSL
![hide](/docbook/includes/images/freemind/hide.png)
HTML 输出的参数控制
![hide](/docbook/includes/images/freemind/hide.png)
分页
![hide](/docbook/includes/images/freemind/hide.png)
可打印版本输出的参数控制
![hide](/docbook/includes/images/freemind/hide.png)
样式表定制层
Customization layers
Customization layers
![hide](/docbook/includes/images/freemind/hide.png)
定制层可以实现
![hide](/docbook/includes/images/freemind/hide.png)
属性集合定制
![hide](/docbook/includes/images/freemind/hide.png)
何为属性集合
![hide](/docbook/includes/images/freemind/hide.png)
如
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:attribute-set name="section.title.properties">
<xsl:attribute name="font-family">
<xsl:value-of select="$title.font.family"/>
</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<!-- font size is calculated dynamically by section.heading template -->
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
<xsl:attribute name="space-before.optimum">1.0em</xsl:attribute>
<xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute name="font-family">
<xsl:value-of select="$title.font.family"/>
</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<!-- font size is calculated dynamically by section.heading template -->
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
<xsl:attribute name="space-before.optimum">1.0em</xsl:attribute>
<xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
</xsl:attribute-set>
![hide](/docbook/includes/images/freemind/hide.png)
充实占位模板
![hide](/docbook/includes/images/freemind/hide.png)
其它占位模板,如:
![leaf](/docbook/includes/images/freemind/leaf.png)
user.preroot
![hide](/docbook/includes/images/freemind/hide.png)
user.head.content
![hide](/docbook/includes/images/freemind/hide.png)
添加 CSS 等
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="target.window" select="'_self'"/>
<xsl:template name="user.head.content">
<xsl:comment> (c) 2002 Copyright Megacorp, Inc. </xsl:comment>
<base target="{$target.window}"/>
<style type="text/css">
<xsl:comment>
@import "stylesheets/override.css"
body {background: url(graphics/bluesea.png);}
</xsl:comment>
</style>
</xsl:template>
<xsl:template name="user.head.content">
<xsl:comment> (c) 2002 Copyright Megacorp, Inc. </xsl:comment>
<base target="{$target.window}"/>
<style type="text/css">
<xsl:comment>
@import "stylesheets/override.css"
body {background: url(graphics/bluesea.png);}
</xsl:comment>
</style>
</xsl:template>
![hide](/docbook/includes/images/freemind/hide.png)
替换样式模板
![hide](/docbook/includes/images/freemind/hide.png)
例如: 替换 body.attributes 模板,
为 body 增加属性定义
为 body 增加属性定义
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:template name="body.attributes">
<xsl:attribute name="onLoad">alert('Thanks for visiting')</xsl:attribute>
<xsl:attribute name="bgcolor">white</xsl:attribute>
<xsl:attribute name="text">black</xsl:attribute>
<xsl:attribute name="link">#0000FF</xsl:attribute>
<xsl:attribute name="vlink">#840084</xsl:attribute>
<xsl:attribute name="alink">#0000FF</xsl:attribute>
</xsl:template>
<xsl:attribute name="onLoad">alert('Thanks for visiting')</xsl:attribute>
<xsl:attribute name="bgcolor">white</xsl:attribute>
<xsl:attribute name="text">black</xsl:attribute>
<xsl:attribute name="link">#0000FF</xsl:attribute>
<xsl:attribute name="vlink">#840084</xsl:attribute>
<xsl:attribute name="alink">#0000FF</xsl:attribute>
</xsl:template>
![hide](/docbook/includes/images/freemind/hide.png)
本地化设置
![hide](/docbook/includes/images/freemind/hide.png)
定制中文姓名显示方式
![hide](/docbook/includes/images/freemind/hide.png)
定制 family-given 模板
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:template name="person.name.family-given">
<xsl:param name="node" select="."/>
<xsl:if test="$node//surname">
<xsl:apply-templates select="$node//surname[1]"/>
</xsl:if>
<xsl:if test="$node//othername and $author.othername.in.middle != 0">
<xsl:if test="$node//surname">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates select="$node//othername[1]"/>
</xsl:if>
<xsl:if test="$node//firstname">
<xsl:if test="$node//surname
or ($node//othername and $author.othername.in.middle != 0)">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates select="$node//firstname[1]"/>
</xsl:if>
<xsl:if test="$node//lineage">
<xsl:text>, </xsl:text>
<xsl:apply-templates select="$node//lineage[1]"/>
</xsl:if>
<xsl:if test="$node//honorific">
<xsl:text> </xsl:text>
<xsl:apply-templates select="$node//honorific[1]"/>
<xsl:value-of select="$punct.honorific"/>
</xsl:if>
</xsl:template>
<xsl:param name="node" select="."/>
<xsl:if test="$node//surname">
<xsl:apply-templates select="$node//surname[1]"/>
</xsl:if>
<xsl:if test="$node//othername and $author.othername.in.middle != 0">
<xsl:if test="$node//surname">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates select="$node//othername[1]"/>
</xsl:if>
<xsl:if test="$node//firstname">
<xsl:if test="$node//surname
or ($node//othername and $author.othername.in.middle != 0)">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates select="$node//firstname[1]"/>
</xsl:if>
<xsl:if test="$node//lineage">
<xsl:text>, </xsl:text>
<xsl:apply-templates select="$node//lineage[1]"/>
</xsl:if>
<xsl:if test="$node//honorific">
<xsl:text> </xsl:text>
<xsl:apply-templates select="$node//honorific[1]"/>
<xsl:value-of select="$punct.honorific"/>
</xsl:if>
</xsl:template>
![hide](/docbook/includes/images/freemind/hide.png)
示例
![hide](/docbook/includes/images/freemind/hide.png)
定制 fo
![hide](/docbook/includes/images/freemind/hide.png)
示例
![leaf](/docbook/includes/images/freemind/leaf.png)
<?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/docbook.xsl"/>
<xsl:template match="lineannotation">
<fo:inline font-style="italic">
<xsl:call-template name="inline.charseq"/>
</fo:inline>
</xsl:template>
</xsl:stylesheet>
<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/docbook.xsl"/>
<xsl:template match="lineannotation">
<fo:inline font-style="italic">
<xsl:call-template name="inline.charseq"/>
</fo:inline>
</xsl:template>
</xsl:stylesheet>
![hide](/docbook/includes/images/freemind/hide.png)
Catalog
![hide](/docbook/includes/images/freemind/hide.png)
Catalog 文件在哪?
![hide](/docbook/includes/images/freemind/hide.png)
Saxon
![hide](/docbook/includes/images/freemind/hide.png)
创建文件 CatalogManager.properties
![hide](/docbook/includes/images/freemind/hide.png)
命令行示例
![leaf](/docbook/includes/images/freemind/leaf.png)
java -cp "/usr/java/saxon.jar:/docbook-xsl/extensions/saxon653.jar:\
/usr/share/resolver.jar;/usr/share" \
com.icl.saxon.StyleSheet \
-x org.apache.xml.resolver.tools.ResolvingXMLReader \
-y org.apache.xml.resolver.tools.ResolvingXMLReader \
-r org.apache.xml.resolver.tools.CatalogResolver \
-u \
-o myfile.html \
myfile.xml docbook.xsl
/usr/share/resolver.jar;/usr/share" \
com.icl.saxon.StyleSheet \
-x org.apache.xml.resolver.tools.ResolvingXMLReader \
-y org.apache.xml.resolver.tools.ResolvingXMLReader \
-r org.apache.xml.resolver.tools.CatalogResolver \
-u \
-o myfile.html \
myfile.xml docbook.xsl
![hide](/docbook/includes/images/freemind/hide.png)
Xalan
![hide](/docbook/includes/images/freemind/hide.png)
命令行为
![leaf](/docbook/includes/images/freemind/leaf.png)
java -cp "/usr/java/xerces.jar:/usr/java/xalan.jar:\
/docbook-xsl/extensions/xalan25.jar:\
/usr/share/resolver.jar:/usr/share" \
org.apache.xalan.xslt.Process \
-ENTITYRESOLVER org.apache.xml.resolver.tools.CatalogResolver \
-URIRESOLVER org.apache.xml.resolver.tools.CatalogResolver \
-out myfile.html \
-in myfile.xml \
-xsl http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
/docbook-xsl/extensions/xalan25.jar:\
/usr/share/resolver.jar:/usr/share" \
org.apache.xalan.xslt.Process \
-ENTITYRESOLVER org.apache.xml.resolver.tools.CatalogResolver \
-URIRESOLVER org.apache.xml.resolver.tools.CatalogResolver \
-out myfile.html \
-in myfile.xml \
-xsl http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
![hide](/docbook/includes/images/freemind/hide.png)
示例
![leaf](/docbook/includes/images/freemind/leaf.png)
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<!-- DTD and stylesheet files installed under /usr/share/xml -->
<group xml:base="file:///usr/share/xml/" >
<!-- Resolve DTD URL system ID to local file -->
<rewriteSystem
systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4/"
rewritePrefix="docbook44/" />
<!-- Resolve stylesheet URL to local file -->
<rewriteURI
uriStartString="http://docbook.sourceforge.net/release/xsl/current/"
rewritePrefix="docbook-xsl-1.68.1/" />
<!-- Resolve DTD PUBLIC identifiers -->
<nextCatalog catalog="docbook44/catalog.xml" />
<!-- To resolve simple DTD SYSTEM identifiers. -->
<!-- Note: this does not work with Java resolver -->
<!-- classes in Saxon or Xalan -->
<system
systemId="docbook.dtd"
uri="docbook44/docbookx.dtd" />
<!-- To resolve short stylesheet references -->
<uri
name="docbook.xsl"
uri="docbook-xsl-1.68.1/html/docbook.xsl" />
<uri
name="chunk.xsl"
uri="docbook-xsl-1.68.1/html/chunk.xsl" />
<uri
name="fo-docbook.xsl"
uri="docbook-xsl-1.68.1/fo/docbook.xsl" />
</group>
</catalog>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<!-- DTD and stylesheet files installed under /usr/share/xml -->
<group xml:base="file:///usr/share/xml/" >
<!-- Resolve DTD URL system ID to local file -->
<rewriteSystem
systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4/"
rewritePrefix="docbook44/" />
<!-- Resolve stylesheet URL to local file -->
<rewriteURI
uriStartString="http://docbook.sourceforge.net/release/xsl/current/"
rewritePrefix="docbook-xsl-1.68.1/" />
<!-- Resolve DTD PUBLIC identifiers -->
<nextCatalog catalog="docbook44/catalog.xml" />
<!-- To resolve simple DTD SYSTEM identifiers. -->
<!-- Note: this does not work with Java resolver -->
<!-- classes in Saxon or Xalan -->
<system
systemId="docbook.dtd"
uri="docbook44/docbookx.dtd" />
<!-- To resolve short stylesheet references -->
<uri
name="docbook.xsl"
uri="docbook-xsl-1.68.1/html/docbook.xsl" />
<uri
name="chunk.xsl"
uri="docbook-xsl-1.68.1/html/chunk.xsl" />
<uri
name="fo-docbook.xsl"
uri="docbook-xsl-1.68.1/fo/docbook.xsl" />
</group>
</catalog>
![hide](/docbook/includes/images/freemind/hide.png)
XInclude
![hide](/docbook/includes/images/freemind/hide.png)
XInclude示例
![hide](/docbook/includes/images/freemind/hide.png)
文件 index.xml
(包含 intro.xml)
(包含 intro.xml)
![leaf](/docbook/includes/images/freemind/leaf.png)
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<book>
<title>User Guide</title>
<para>This guide shows you how to use the software.</para>
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude" href="intro.xml" />
...
</book>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<book>
<title>User Guide</title>
<para>This guide shows you how to use the software.</para>
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude" href="intro.xml" />
...
</book>
![hide](/docbook/includes/images/freemind/hide.png)
XInclude语法要点
![hide](/docbook/includes/images/freemind/hide.png)
entities
![hide](/docbook/includes/images/freemind/hide.png)
示例
![leaf](/docbook/includes/images/freemind/leaf.png)
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!ENTITY intro "part1/intro.xml">
<!ENTITY basics "part1/getting_started.xml">
<!ENTITY config "admin/configuring_the_server.xml">
<!ENTITY advanced "admin/advanced_user_moves.xml">
]>
<book>
<title>User Guide</title>
<para>This guide shows you how to use the software.</para>
<xi:include href="&intro;" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="&basics;" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="&config;" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="&advanced;" xmlns:xi="http://www.w3.org/2001/XInclude"/>
...
</book>
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!ENTITY intro "part1/intro.xml">
<!ENTITY basics "part1/getting_started.xml">
<!ENTITY config "admin/configuring_the_server.xml">
<!ENTITY advanced "admin/advanced_user_moves.xml">
]>
<book>
<title>User Guide</title>
<para>This guide shows you how to use the software.</para>
<xi:include href="&intro;" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="&basics;" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="&config;" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="&advanced;" xmlns:xi="http://www.w3.org/2001/XInclude"/>
...
</book>
![hide](/docbook/includes/images/freemind/hide.png)
Xalan
![hide](/docbook/includes/images/freemind/hide.png)
fop
![hide](/docbook/includes/images/freemind/hide.png)
中文支持问题
![hide](/docbook/includes/images/freemind/hide.png)
xsl 定制
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:import href="C:/docbook/docbook-xsl-1.68.1/fo/docbook.xsl"/>
<xsl:param name="fop.extensions" select="1" />
<xsl:param name="variablelist.as.blocks" select="1" />
<xsl:param name="chunker.output.encoding" select="'utf-8'" />
<xsl:param name="use.extensions" select="1" />
<xsl:param name="l10n.gentext.language" select="'zh_cn'" />
<xsl:param name="admon.graphics" select="1" />
<!--xsl:param name="draft.watermark.image" select="images/draft.png"></xsl:param-->
<xsl:param name="body.font.family">SimSun</xsl:param>
<xsl:param name="title.font.family">SimSun</xsl:param>
</xsl:stylesheet>
<xsl:import href="C:/docbook/docbook-xsl-1.68.1/fo/docbook.xsl"/>
<xsl:param name="fop.extensions" select="1" />
<xsl:param name="variablelist.as.blocks" select="1" />
<xsl:param name="chunker.output.encoding" select="'utf-8'" />
<xsl:param name="use.extensions" select="1" />
<xsl:param name="l10n.gentext.language" select="'zh_cn'" />
<xsl:param name="admon.graphics" select="1" />
<!--xsl:param name="draft.watermark.image" select="images/draft.png"></xsl:param-->
<xsl:param name="body.font.family">SimSun</xsl:param>
<xsl:param name="title.font.family">SimSun</xsl:param>
</xsl:stylesheet>
![hide](/docbook/includes/images/freemind/hide.png)
fop 配置,增加中文字体
![leaf](/docbook/includes/images/freemind/leaf.png)
我们需要userconfig.xml来改变编译FO到PDF的一些默认属性,因为我们需要中文字体,需要用ttfreader.cmd来生成字体文件,这里我已经生成了文件在fonts目录下。然后建立userconfig.xml文件
![hide](/docbook/includes/images/freemind/hide.png)
userconfig.xml
![leaf](/docbook/includes/images/freemind/leaf.png)
<!--<!DOCTYPE configuration SYSTEM "config.dtd">-->
<!--
this file contains templates which allow an user easy
configuration of Fop. Actually normally you don't need this configuration
file, but if you need to change configuration, you should
always use this file and *not* config.xml.
Usage: java org.apache.fop.apps.Fop -c userconfig.xml -fo fo-file -pdf pdf-file
-->
<configuration>
<!--
baseDir: normally the base directory is the directory where the fo file is
located. if you want to specify your own, uncomment this entry.
This value can also be a URL. Actually, the value is converted to
a URL.
-->
<!--
<entry>
<key>baseDir</key>
<value></value>
</entry>
-->
<!--
fontBaseDir: Similar to baseDir, except that this value is used for fonts. If
it isn't specified, the value from baseDir is used.
-->
<!--
<entry>
<key>fontBaseDir</key>
<value></value>
</entry>
-->
<!--
************************************************************************
HYPHENATION
************************************************************************
-->
<!--
hyphenation directory
if you want to specify your own directory with hyphenation pattern
then uncomment the next entry and add the directory name
-->
<!--
<entry>
<key>hyphenation-dir</key>
<value>/java/xml-fop/hyph</value>
</entry>
-->
<!--
************************************************************************
Add fonts here
************************************************************************
-->
<fonts>
<!-- example -->
<font metrics-file="fonts\simfang.xml" kerning="yes" embed-file="C:\WINDOWS\Fonts\simfang.ttf">
<font-triplet name="FangSong_GB2312" style="normal" weight="normal"/>
</font>
<!--
<font metrics-file="arialb.xml" kerning="yes" embed-file="arialb.ttf">
<font-triplet name="Arial" style="normal" weight="bold"/>
<font-triplet name="ArialMT" style="normal" weight="bold"/>
</font>
<font metrics-file="ariali.xml" kerning="yes" embed-file="ariali.ttf">
<font-triplet name="Arial" style="italic" weight="normal"/>
<font-triplet name="ArialMT" style="italic" weight="normal"/>
</font>
<font metrics-file="arialbi.xml" kerning="yes" embed-file="arialbi.ttf">
<font-triplet name="Arial" style="italic" weight="bold"/>
<font-triplet name="ArialMT" style="italic" weight="bold"/>
</font>
-->
<font metrics-file="fonts\simsun.xml" embed-file="C:\windows\fonts\simsun.ttc" kerning="yes">
<font-triplet name="SimSun" style="normal" weight="normal"/>
<font-triplet name="SimSun" style="normal" weight="bold"/>
<font-triplet name="NSimSun" style="italic" weight="normal"/>
<font-triplet name="NSimSun" style="italic" weight="bold"/>
</font>
<!-- Example Japanese fonts
<font metrics-file="msmincho.xml" embed-file="Cyberbit.ttf" kerning="yes">
<font-triplet name="Mincho" style="normal" weight="normal"/>
<font-triplet name="Mincho" style="normal" weight="bold"/>
<font-triplet name="Mincho" style="italic" weight="normal"/>
<font-triplet name="Mincho" style="italic" weight="bold"/>
</font>
-->
</fonts>
</configuration>
<!--
this file contains templates which allow an user easy
configuration of Fop. Actually normally you don't need this configuration
file, but if you need to change configuration, you should
always use this file and *not* config.xml.
Usage: java org.apache.fop.apps.Fop -c userconfig.xml -fo fo-file -pdf pdf-file
-->
<configuration>
<!--
baseDir: normally the base directory is the directory where the fo file is
located. if you want to specify your own, uncomment this entry.
This value can also be a URL. Actually, the value is converted to
a URL.
-->
<!--
<entry>
<key>baseDir</key>
<value></value>
</entry>
-->
<!--
fontBaseDir: Similar to baseDir, except that this value is used for fonts. If
it isn't specified, the value from baseDir is used.
-->
<!--
<entry>
<key>fontBaseDir</key>
<value></value>
</entry>
-->
<!--
************************************************************************
HYPHENATION
************************************************************************
-->
<!--
hyphenation directory
if you want to specify your own directory with hyphenation pattern
then uncomment the next entry and add the directory name
-->
<!--
<entry>
<key>hyphenation-dir</key>
<value>/java/xml-fop/hyph</value>
</entry>
-->
<!--
************************************************************************
Add fonts here
************************************************************************
-->
<fonts>
<!-- example -->
<font metrics-file="fonts\simfang.xml" kerning="yes" embed-file="C:\WINDOWS\Fonts\simfang.ttf">
<font-triplet name="FangSong_GB2312" style="normal" weight="normal"/>
</font>
<!--
<font metrics-file="arialb.xml" kerning="yes" embed-file="arialb.ttf">
<font-triplet name="Arial" style="normal" weight="bold"/>
<font-triplet name="ArialMT" style="normal" weight="bold"/>
</font>
<font metrics-file="ariali.xml" kerning="yes" embed-file="ariali.ttf">
<font-triplet name="Arial" style="italic" weight="normal"/>
<font-triplet name="ArialMT" style="italic" weight="normal"/>
</font>
<font metrics-file="arialbi.xml" kerning="yes" embed-file="arialbi.ttf">
<font-triplet name="Arial" style="italic" weight="bold"/>
<font-triplet name="ArialMT" style="italic" weight="bold"/>
</font>
-->
<font metrics-file="fonts\simsun.xml" embed-file="C:\windows\fonts\simsun.ttc" kerning="yes">
<font-triplet name="SimSun" style="normal" weight="normal"/>
<font-triplet name="SimSun" style="normal" weight="bold"/>
<font-triplet name="NSimSun" style="italic" weight="normal"/>
<font-triplet name="NSimSun" style="italic" weight="bold"/>
</font>
<!-- Example Japanese fonts
<font metrics-file="msmincho.xml" embed-file="Cyberbit.ttf" kerning="yes">
<font-triplet name="Mincho" style="normal" weight="normal"/>
<font-triplet name="Mincho" style="normal" weight="bold"/>
<font-triplet name="Mincho" style="italic" weight="normal"/>
<font-triplet name="Mincho" style="italic" weight="bold"/>
</font>
-->
</fonts>
</configuration>
![hide](/docbook/includes/images/freemind/hide.png)
DocBook 元素参考
![hide](/docbook/includes/images/freemind/hide.png)
词汇修饰
![hide](/docbook/includes/images/freemind/hide.png)
视窗对象
![leaf](/docbook/includes/images/freemind/leaf.png)
其它类似元素:
guibutton, guiicon, guilabel, guimenu, guimenuitem, guisubmenu, keycap, keycode, keycombo, keysym, menuchoice, mousebutton, shortcut
guibutton, guiicon, guilabel, guimenu, guimenuitem, guisubmenu, keycap, keycode, keycombo, keysym, menuchoice, mousebutton, shortcut
![hide](/docbook/includes/images/freemind/hide.png)
guiicon
![hide](/docbook/includes/images/freemind/hide.png)
例如
![leaf](/docbook/includes/images/freemind/leaf.png)
<para>The exact text of the <guilabel>Legend</guilabel> and other labels on the
graph is dependent upon the language of the current locale. Likewise,
the text of the <guibutton>OK</guibutton> button and other buttons may vary.
The <guiicon><inlinemediaobject>
<imageobject>
<imagedata fileref="figures/legend.png"/>
</imageobject>
</inlinemediaobject></guiicon>
icon and the other icons on the left side of the display may be
configured by the local administrator, but they are not
generally expected to vary from locale to locale.
</para>
graph is dependent upon the language of the current locale. Likewise,
the text of the <guibutton>OK</guibutton> button and other buttons may vary.
The <guiicon><inlinemediaobject>
<imageobject>
<imagedata fileref="figures/legend.png"/>
</imageobject>
</inlinemediaobject></guiicon>
icon and the other icons on the left side of the display may be
configured by the local administrator, but they are not
generally expected to vary from locale to locale.
</para>
![hide](/docbook/includes/images/freemind/hide.png)
建立链接
![hide](/docbook/includes/images/freemind/hide.png)
link
![leaf](/docbook/includes/images/freemind/leaf.png)
如果 link 元素没有内容,并且具有 endterm 属性,将 endterm 指向的元素的值,拷贝到 link 处,并作为热点文字,指向 linkend 指向的文档内部的 endterm 指向的链接;
![hide](/docbook/includes/images/freemind/hide.png)
例如
![leaf](/docbook/includes/images/freemind/leaf.png)
<sect1><title>Examples of <sgmltag>Link</sgmltag></title>
<para>
In this sentence <link linkend='nextsect'>this</link> word is
hot and points to the following section.
</para>
<para>
There is also a link to the section called
<quote><link linkend='nextsect' endterm="nextsect.title"/></quote>
in this sentence.
</para>
<sect2 id='nextsect'><title id='nextsect.title'>A Subsection</title>
<para>
This section only exists to be the target of a couple of links.
</para>
</sect2>
</sect1>
<para>
In this sentence <link linkend='nextsect'>this</link> word is
hot and points to the following section.
</para>
<para>
There is also a link to the section called
<quote><link linkend='nextsect' endterm="nextsect.title"/></quote>
in this sentence.
</para>
<sect2 id='nextsect'><title id='nextsect.title'>A Subsection</title>
<para>
This section only exists to be the target of a couple of links.
</para>
</sect2>
</sect1>
![hide](/docbook/includes/images/freemind/hide.png)
表格
![hide](/docbook/includes/images/freemind/hide.png)
table
![hide](/docbook/includes/images/freemind/hide.png)
示例
![leaf](/docbook/includes/images/freemind/leaf.png)
<table frame='all'><title>Sample Table</title>
<tgroup cols='5' align='left' colsep='1' rowsep='1'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colnum='5' colname='c5'/>
<thead>
<row>
<entry namest="c1" nameend="c2" align="center">Horizontal Span</entry>
<entry>a3</entry>
<entry>a4</entry>
<entry>a5</entry>
</row>
</thead>
<tfoot>
<row>
<entry>f1</entry>
<entry>f2</entry>
<entry>f3</entry>
<entry>f4</entry>
<entry>f5</entry>
</row>
</tfoot>
<tbody>
<row>
<entry>b1</entry>
<entry>b2</entry>
<entry>b3</entry>
<entry>b4</entry>
<entry morerows='1' valign='middle'><para> <!-- Pernicous Mixed Content -->
Vertical Span</para></entry>
</row>
<row>
<entry>c1</entry>
<entry namest="c2" nameend="c3" align='center' morerows='1' valign='bottom'>Span Both</entry>
<entry>c4</entry>
</row>
<row>
<entry>d1</entry>
<entry>d4</entry>
<entry>d5</entry>
</row>
</tbody>
</tgroup>
</table>
<tgroup cols='5' align='left' colsep='1' rowsep='1'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colnum='5' colname='c5'/>
<thead>
<row>
<entry namest="c1" nameend="c2" align="center">Horizontal Span</entry>
<entry>a3</entry>
<entry>a4</entry>
<entry>a5</entry>
</row>
</thead>
<tfoot>
<row>
<entry>f1</entry>
<entry>f2</entry>
<entry>f3</entry>
<entry>f4</entry>
<entry>f5</entry>
</row>
</tfoot>
<tbody>
<row>
<entry>b1</entry>
<entry>b2</entry>
<entry>b3</entry>
<entry>b4</entry>
<entry morerows='1' valign='middle'><para> <!-- Pernicous Mixed Content -->
Vertical Span</para></entry>
</row>
<row>
<entry>c1</entry>
<entry namest="c2" nameend="c3" align='center' morerows='1' valign='bottom'>Span Both</entry>
<entry>c4</entry>
</row>
<row>
<entry>d1</entry>
<entry>d4</entry>
<entry>d5</entry>
</row>
</tbody>
</tgroup>
</table>
![hide](/docbook/includes/images/freemind/hide.png)
Example
![hide](/docbook/includes/images/freemind/hide.png)
example
![hide](/docbook/includes/images/freemind/hide.png)
示例
![leaf](/docbook/includes/images/freemind/leaf.png)
<example><title>A DSSSL Function</title>
<programlisting>
(define (node-list-filter-by-gi nodelist gilist)
;; Returns the node-list that contains every element of the original
;; nodelist whose gi is in gilist
(let loop ((result (empty-node-list)) (nl nodelist))
(if (node-list-empty? nl)
result
(if (member (gi (node-list-first nl)) gilist)
(loop (node-list result (node-list-first nl))
(node-list-rest nl))
(loop result (node-list-rest nl))))))
</programlisting>
</example>
<programlisting>
(define (node-list-filter-by-gi nodelist gilist)
;; Returns the node-list that contains every element of the original
;; nodelist whose gi is in gilist
(let loop ((result (empty-node-list)) (nl nodelist))
(if (node-list-empty? nl)
result
(if (member (gi (node-list-first nl)) gilist)
(loop (node-list result (node-list-first nl))
(node-list-rest nl))
(loop result (node-list-rest nl))))))
</programlisting>
</example>
![hide](/docbook/includes/images/freemind/hide.png)
DocBook Website
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![hide](/docbook/includes/images/freemind/hide.png)
website 的 DTD
![hide](/docbook/includes/images/freemind/hide.png)
在 catalog.xml 添加条目
![leaf](/docbook/includes/images/freemind/leaf.png)
<nextCatalog catalog="website/2.6.0/catalog.xml" />
<!-- 由于 website DTD 中用到了 4.4 版本的 DocBook DTD, 故有如下定义-->
<rewriteSystem
systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4/"
rewritePrefix="dtd/docbook-4.5/" />
<rewriteSystem
systemIdStartString="http://docbook.org/xml/4.4/"
rewritePrefix="dtd/docbook-4.5/" />
<!-- 由于 website DTD 中用到了 4.4 版本的 DocBook DTD, 故有如下定义-->
<rewriteSystem
systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4/"
rewritePrefix="dtd/docbook-4.5/" />
<rewriteSystem
systemIdStartString="http://docbook.org/xml/4.4/"
rewritePrefix="dtd/docbook-4.5/" />
![hide](/docbook/includes/images/freemind/hide.png)
![forward](/docbook/includes/images/freemind/icons/forward.png)
layout.xml 文件
![hide](/docbook/includes/images/freemind/hide.png)
tocentry 元素
![hide](/docbook/includes/images/freemind/hide.png)
更多示例
![leaf](/docbook/includes/images/freemind/leaf.png)
<toc page="website.xml"
filename="index.html">
<tocentry page="wslayout.xml"
revisionflag="changed"
filename="layout.html"/>
<tocentry page="olink.xml"
filename="linking.html"/>
<tocentry page="custom.xml"
filename="custom.html"/>
<tocentry page="building.xml"
filename="building.html"
tocskip='1'>
<tocentry page="build-make.xml"
filename="buildmake.html"
dir="build"/>
<tocentry page="build-ext.xml"
filename="buildext.html"
dir="build"/>
<tocentry page="build-textonly.xml"
filename="textonly.html"
dir="build"/>
</tocentry>
<tocentry page="test2.xml"
filename="formtest.html"/>
...
</toc>
filename="index.html">
<tocentry page="wslayout.xml"
revisionflag="changed"
filename="layout.html"/>
<tocentry page="olink.xml"
filename="linking.html"/>
<tocentry page="custom.xml"
filename="custom.html"/>
<tocentry page="building.xml"
filename="building.html"
tocskip='1'>
<tocentry page="build-make.xml"
filename="buildmake.html"
dir="build"/>
<tocentry page="build-ext.xml"
filename="buildext.html"
dir="build"/>
<tocentry page="build-textonly.xml"
filename="textonly.html"
dir="build"/>
</tocentry>
<tocentry page="test2.xml"
filename="formtest.html"/>
...
</toc>
![hide](/docbook/includes/images/freemind/hide.png)
网页之间的链接: olink
![hide](/docbook/includes/images/freemind/hide.png)
两种编译方式
![hide](/docbook/includes/images/freemind/hide.png)
Makefile 编译
![hide](/docbook/includes/images/freemind/hide.png)
Makefile 示例
![leaf](/docbook/includes/images/freemind/leaf.png)
PROC = XML_CATALOG_FILES=/docbook/src/catalog.xml xsltproc --nonet
XSLPATH = /docbook/src/xsl/docbook-xsl-1.69.1/website
all:
make website
include depends.tabular
autolayout.xml: layout.xml
$(PROC) \
--output $@ \
$(XSLPATH)/autolayout.xsl $<
make depends
depends: autolayout.xml
$(PROC) \
--output depends.tabular \
--stringparam output-root htdocs \
$(XSLPATH)/makefile-dep.xsl $<
website.database.xml: autolayout.xml
$(PROC) \
--output $@ \
$(XSLPATH)/website-targets.xsl $<
%.html: autolayout.xml
$(PROC) \
--output $@ \
--stringparam website.database.document website.database.xml \
--stringparam output-root htdocs \
$(XSLPATH)/tabular.xsl \
$(filter-out autolayout.xml,$^)
XSLPATH = /docbook/src/xsl/docbook-xsl-1.69.1/website
all:
make website
include depends.tabular
autolayout.xml: layout.xml
$(PROC) \
--output $@ \
$(XSLPATH)/autolayout.xsl $<
make depends
depends: autolayout.xml
$(PROC) \
--output depends.tabular \
--stringparam output-root htdocs \
$(XSLPATH)/makefile-dep.xsl $<
website.database.xml: autolayout.xml
$(PROC) \
--output $@ \
$(XSLPATH)/website-targets.xsl $<
%.html: autolayout.xml
$(PROC) \
--output $@ \
--stringparam website.database.document website.database.xml \
--stringparam output-root htdocs \
$(XSLPATH)/tabular.xsl \
$(filter-out autolayout.xml,$^)
![hide](/docbook/includes/images/freemind/hide.png)
DocBook XSL 解密
![hide](/docbook/includes/images/freemind/hide.png)
website
![hide](/docbook/includes/images/freemind/hide.png)
![gohome](/docbook/includes/images/freemind/icons/gohome.png)
![ksmiletris](/docbook/includes/images/freemind/icons/ksmiletris.png)
tabular.xsl
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![hide](/docbook/includes/images/freemind/hide.png)
![messagebox_warning](/docbook/includes/images/freemind/icons/messagebox_warning.png)
模板 <xsl:template match="webpage">
![hide](/docbook/includes/images/freemind/hide.png)
![bell](/docbook/includes/images/freemind/icons/bell.png)
<xsl:call-template name="body.attributes"/>
![hide](/docbook/includes/images/freemind/hide.png)
![messagebox_warning](/docbook/includes/images/freemind/icons/messagebox_warning.png)
html/docbook.xsl
![leaf](/docbook/includes/images/freemind/leaf.png)
定义样式
<xsl:template name="body.attributes">
<xsl:attribute name="bgcolor">white</xsl:attribute>
<xsl:attribute name="text">black</xsl:attribute>
<xsl:attribute name="link">#0000FF</xsl:attribute>
<xsl:attribute name="vlink">#840084</xsl:attribute>
<xsl:attribute name="alink">#0000FF</xsl:attribute>
</xsl:template>
<xsl:template name="body.attributes">
<xsl:attribute name="bgcolor">white</xsl:attribute>
<xsl:attribute name="text">black</xsl:attribute>
<xsl:attribute name="link">#0000FF</xsl:attribute>
<xsl:attribute name="vlink">#840084</xsl:attribute>
<xsl:attribute name="alink">#0000FF</xsl:attribute>
</xsl:template>
![hide](/docbook/includes/images/freemind/hide.png)
![forward](/docbook/includes/images/freemind/icons/forward.png)
![flag](/docbook/includes/images/freemind/icons/flag.png)
website-common.xsl
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![hide](/docbook/includes/images/freemind/hide.png)
![forward](/docbook/includes/images/freemind/icons/forward.png)
![ksmiletris](/docbook/includes/images/freemind/icons/ksmiletris.png)
param.xsl
![hide](/docbook/includes/images/freemind/hide.png)
feedback
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="feedback.href"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="feedback.with.ids" select="0"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="feedback.link.text">Feedback</xsl:param>
![hide](/docbook/includes/images/freemind/hide.png)
导航条
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="banner.before.navigation" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="navtocwidth">220</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="navbodywidth"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="navbgcolor">#4080FF</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="textbgcolor">white</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.spacer.graphic" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.spacer.text"> </xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.spacer.image">graphics/blank.gif</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.pointer.graphic" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.pointer.text"> > </xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.pointer.image">graphics/arrow.gif</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.blank.graphic" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.blank.text"> </xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.blank.image">graphics/blank.gif</xsl:param>
![hide](/docbook/includes/images/freemind/hide.png)
![gohome](/docbook/includes/images/freemind/icons/gohome.png)
![ksmiletris](/docbook/includes/images/freemind/icons/ksmiletris.png)
website.xsl
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![hide](/docbook/includes/images/freemind/hide.png)
模板 <xsl:template match="webpage">
![hide](/docbook/includes/images/freemind/hide.png)
![bell](/docbook/includes/images/freemind/icons/bell.png)
<xsl:call-template name="body.attributes"/>
![hide](/docbook/includes/images/freemind/hide.png)
![messagebox_warning](/docbook/includes/images/freemind/icons/messagebox_warning.png)
html/docbook.xsl
![leaf](/docbook/includes/images/freemind/leaf.png)
定义样式
<xsl:template name="body.attributes">
<xsl:attribute name="bgcolor">white</xsl:attribute>
<xsl:attribute name="text">black</xsl:attribute>
<xsl:attribute name="link">#0000FF</xsl:attribute>
<xsl:attribute name="vlink">#840084</xsl:attribute>
<xsl:attribute name="alink">#0000FF</xsl:attribute>
</xsl:template>
<xsl:template name="body.attributes">
<xsl:attribute name="bgcolor">white</xsl:attribute>
<xsl:attribute name="text">black</xsl:attribute>
<xsl:attribute name="link">#0000FF</xsl:attribute>
<xsl:attribute name="vlink">#840084</xsl:attribute>
<xsl:attribute name="alink">#0000FF</xsl:attribute>
</xsl:template>
![hide](/docbook/includes/images/freemind/hide.png)
![forward](/docbook/includes/images/freemind/icons/forward.png)
![flag](/docbook/includes/images/freemind/icons/flag.png)
chunk-common.xsl
![hide](/docbook/includes/images/freemind/hide.png)
OSX 定制
![hide](/docbook/includes/images/freemind/hide.png)
模板 template/layout.xml
![hide](/docbook/includes/images/freemind/hide.png)
config
![leaf](/docbook/includes/images/freemind/leaf.png)
<config param="homebanner-tabular" value="/images/logo/homebanner.png"
altval="Home Banner"/>
<config param="banner-tabular" value="/images/logo/banner.png"
altval="Banner"/>
<config param="homebanner" value="/images/logo/homebanner.png"
altval="Home Banner"/>
<config param="banner" value="/images/logo/iconhome.gif"
altval="Banner"/>
<config param="navbgcolor" value="#4080FF"/>
<config param="footer" value="http://www.worldhello.net" altval="FT:WorldHello"/>
<config param="footlink" value="about" altval="FL:关于"/>
<config param="feedback.href" value="webmaster@mysite.com"/>
altval="Home Banner"/>
<config param="banner-tabular" value="/images/logo/banner.png"
altval="Banner"/>
<config param="homebanner" value="/images/logo/homebanner.png"
altval="Home Banner"/>
<config param="banner" value="/images/logo/iconhome.gif"
altval="Banner"/>
<config param="navbgcolor" value="#4080FF"/>
<config param="footer" value="http://www.worldhello.net" altval="FT:WorldHello"/>
<config param="footlink" value="about" altval="FL:关于"/>
<config param="feedback.href" value="webmaster@mysite.com"/>
![hide](/docbook/includes/images/freemind/hide.png)
![forward](/docbook/includes/images/freemind/icons/forward.png)
![ksmiletris](/docbook/includes/images/freemind/icons/ksmiletris.png)
osx-common.xsl
![hide](/docbook/includes/images/freemind/hide.png)
是否用水平分隔线分隔正文于 header 和 footer
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="header.hr" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="footer.hr" select="1"/>
![hide](/docbook/includes/images/freemind/hide.png)
导航条以及正文的背景颜色设置
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="textbgcolor">white</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="navbgcolor">#4080FF</xsl:param>
![hide](/docbook/includes/images/freemind/hide.png)
以图标方式显示警告
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="admon.graphics" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="admon.textlabel" select="0"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="admon.graphics.path">/images/docbook/</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="admon.graphics.extension">.png</xsl:param>
![hide](/docbook/includes/images/freemind/hide.png)
以图标方式显示导航
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="navig.graphics" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="navig.graphics.path">/images/docbook/</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="navig.graphics.extension">.png</xsl:param>
![hide](/docbook/includes/images/freemind/hide.png)
以图标方式显示 callout
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="callout.graphics" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="callout.graphics.path">/images/callouts/</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="callout.graphics.extension">.png</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="callout.graphics.number.limit">15</xsl:param>
![hide](/docbook/includes/images/freemind/hide.png)
其它图片
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.spacer.image">/images/docbook/blank.png</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.pointer.image">/images/docbook/arrow.png</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="toc.blank.image">/images/docbook/blank.png</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="table.spacer.image">/images/docbook/spacer.png</xsl:param>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="nav.icon.path">/images/navicons/</xsl:param>
![hide](/docbook/includes/images/freemind/hide.png)
是否章节编号
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="section.autolabel" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="section.label.includes.component.label" select="1"/>
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="section.autolabel.max.depth" select="8"/>
![hide](/docbook/includes/images/freemind/hide.png)
参数定制
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:import href="chunk-tabular.xsl"/>
<!-- Website stylesheet parameters -->
<xsl:param name="footer.hr" select="0"/>
<xsl:param name="feedback.link.text">Send us feedback</xsl:param>
<xsl:param name="textbgcolor">#C8C8C8</xsl:param>
<!-- DocBook stylesheet parameters -->
<xsl:param name="admon.graphics" select="1"/>
<!-- Website stylesheet parameters -->
<xsl:param name="footer.hr" select="0"/>
<xsl:param name="feedback.link.text">Send us feedback</xsl:param>
<xsl:param name="textbgcolor">#C8C8C8</xsl:param>
<!-- DocBook stylesheet parameters -->
<xsl:param name="admon.graphics" select="1"/>
![hide](/docbook/includes/images/freemind/hide.png)
GIMP 风格 website
![hide](/docbook/includes/images/freemind/hide.png)
netfilter
![hide](/docbook/includes/images/freemind/hide.png)
website xsl
![hide](/docbook/includes/images/freemind/hide.png)
![gohome](/docbook/includes/images/freemind/icons/gohome.png)
![ksmiletris](/docbook/includes/images/freemind/icons/ksmiletris.png)
mine.xsl
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![hide](/docbook/includes/images/freemind/hide.png)
DocBook
![hide](/docbook/includes/images/freemind/hide.png)
![forward](/docbook/includes/images/freemind/icons/forward.png)
l10n
![hide](/docbook/includes/images/freemind/hide.png)
![forward](/docbook/includes/images/freemind/icons/forward.png)
common/l10n.xsl
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:param name="l10n.xml" select="document('../common/l10n.xml')"/>
<xsl:param name="local.l10n.xml" select="document('')"/>
<xsl:param name="local.l10n.xml" select="document('')"/>
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![leaf](/docbook/includes/images/freemind/leaf.png)
<xsl:template name="gentext.nav.home">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-home'"/>
</xsl:call-template>
</xsl:template>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-home'"/>
</xsl:call-template>
</xsl:template>
![Arrow Link](/docbook/includes/images/freemind/ilink.png)
![hide](/docbook/includes/images/freemind/hide.png)
![ksmiletris](/docbook/includes/images/freemind/icons/ksmiletris.png)
<xsl:template name="gentext">
![hide](/docbook/includes/images/freemind/hide.png)
调试 l10n
![leaf](/docbook/includes/images/freemind/leaf.png)
在文件 common/l10n.xsl 的 gentext 模板中,添加 <xsl:message> 诊断元素
<xsl:template name="gentext">
...
<xsl:if test="$key = 'nav-home'">
<xsl:message terminate="yes">
language: <xsl:value-of select="$lang"/>,
local.l10n.gentext: <xsl:value-of select="$local.l10n.gentext/@text"/>,
l10n.gentext: <xsl:value-of select="$l10n.gentext/@text"/>
</xsl:message>
</xsl:if>
<xsl:template name="gentext">
...
<xsl:if test="$key = 'nav-home'">
<xsl:message terminate="yes">
language: <xsl:value-of select="$lang"/>,
local.l10n.gentext: <xsl:value-of select="$local.l10n.gentext/@text"/>,
l10n.gentext: <xsl:value-of select="$l10n.gentext/@text"/>
</xsl:message>
</xsl:if>
![hide](/docbook/includes/images/freemind/hide.png)
![forward](/docbook/includes/images/freemind/icons/forward.png)
olink
![hide](/docbook/includes/images/freemind/hide.png)
target.database.filename
![hide](/docbook/includes/images/freemind/hide.png)
示例
![leaf](/docbook/includes/images/freemind/leaf.png)
<targetset>
<document targetdoc="osx" baseuri="http://www.OpenSourceXpress.com">
<div href="/" targetptr="full">
<xreftext>北京群英汇信息技术有限公司</xreftext>
</div>
<div href="/" targetptr="short">
<xreftext>群英汇</xreftext>
</div>
<div href="/" targetptr="web">
<xreftext>http://www.OpenSourceXpress.com/</xreftext>
</div>
</document>
</targetset>
<document targetdoc="osx" baseuri="http://www.OpenSourceXpress.com">
<div href="/" targetptr="full">
<xreftext>北京群英汇信息技术有限公司</xreftext>
</div>
<div href="/" targetptr="short">
<xreftext>群英汇</xreftext>
</div>
<div href="/" targetptr="web">
<xreftext>http://www.OpenSourceXpress.com/</xreftext>
</div>
</document>
</targetset>
![hide](/docbook/includes/images/freemind/hide.png)
人物
![hide](/docbook/includes/images/freemind/hide.png)
FOP
![hide](/docbook/includes/images/freemind/hide.png)
需要的软件
![hide](/docbook/includes/images/freemind/hide.png)
FOP 版本
![hide](/docbook/includes/images/freemind/hide.png)
0.91beta
![hide](/docbook/includes/images/freemind/hide.png)
fop 中 cygpath,会遇到 filename too long 的问题!
![hide](/docbook/includes/images/freemind/hide.png)
函数 mycygpath
![leaf](/docbook/includes/images/freemind/leaf.png)
function mycygpath()
{
ARGS=""
PATHSEPT=":"
RESULT=""
SPLIT=no
while [ $# -gt 0 ]; do
case $1 in
--unix|-u)
PATHSEPT="\\;"
OUTPATHSEPT=":"
ARGS="$ARGS $1"
;;
--mixed|--windows|-m|-w)
PATHSEPT=":"
OUTPATHSEPT=";"
ARGS="$ARGS $1"
;;
--path|-p)
SPLIT=yes
;;
--*)
ARGS="$ARGS $1"
;;
*)
TMPPATH=$1
;;
esac
shift
done
if [ "$SPLIT" = "no" ]; then
cygpath $ARGS "$TMPPATH"
else
NF=`echo "$TMPPATH" | awk -F${PATHSEPT} '{ print NF }'`
i=1
while [ $i -le $NF ]; do
CMDLINE="echo \"$TMPPATH\" | awk -F${PATHSEPT} '{ print \$$i }'"
PATHITEM=`eval $CMDLINE`
if [ `echo $PATHITEM|wc -c` -lt 100 ]; then
PATHITEM=`cygpath $ARGS $PATHITEM`
fi
if [ "x$RESULT" = "x" ]; then
RESULT="$PATHITEM"
else
RESULT="${RESULT}${OUTPATHSEPT}${PATHITEM}"
fi
i=`expr $i + 1`
done
echo $RESULT
fi
}
{
ARGS=""
PATHSEPT=":"
RESULT=""
SPLIT=no
while [ $# -gt 0 ]; do
case $1 in
--unix|-u)
PATHSEPT="\\;"
OUTPATHSEPT=":"
ARGS="$ARGS $1"
;;
--mixed|--windows|-m|-w)
PATHSEPT=":"
OUTPATHSEPT=";"
ARGS="$ARGS $1"
;;
--path|-p)
SPLIT=yes
;;
--*)
ARGS="$ARGS $1"
;;
*)
TMPPATH=$1
;;
esac
shift
done
if [ "$SPLIT" = "no" ]; then
cygpath $ARGS "$TMPPATH"
else
NF=`echo "$TMPPATH" | awk -F${PATHSEPT} '{ print NF }'`
i=1
while [ $i -le $NF ]; do
CMDLINE="echo \"$TMPPATH\" | awk -F${PATHSEPT} '{ print \$$i }'"
PATHITEM=`eval $CMDLINE`
if [ `echo $PATHITEM|wc -c` -lt 100 ]; then
PATHITEM=`cygpath $ARGS $PATHITEM`
fi
if [ "x$RESULT" = "x" ]; then
RESULT="$PATHITEM"
else
RESULT="${RESULT}${OUTPATHSEPT}${PATHITEM}"
fi
i=`expr $i + 1`
done
echo $RESULT
fi
}
![hide](/docbook/includes/images/freemind/hide.png)
FOP 中文化
![leaf](/docbook/includes/images/freemind/leaf.png)
Use the special xsl to build fo.
(And the FOP has bug to handle FO file which language is zh_cn, So you may have to replace language="zh_cn" to language="zh")
(And the FOP has bug to handle FO file which language is zh_cn, So you may have to replace language="zh_cn" to language="zh")
![leaf](/docbook/includes/images/freemind/leaf.png)
Must have the Chinese font files and use org.apache.fop.fonts.apps.
TTFReader to build the font metrics-files. And build pdf with '-c userconfig.xml' option.
TTFReader to build the font metrics-files. And build pdf with '-c userconfig.xml' option.
![hide](/docbook/includes/images/freemind/hide.png)
增加中文字体
![hide](/docbook/includes/images/freemind/hide.png)
由 FOP TTFReader 生成的 matrics 文件
![hide](/docbook/includes/images/freemind/hide.png)
配置文件 fop/conf/userconfig.xml
![hide](/docbook/includes/images/freemind/hide.png)
在 <fonts></fonts> 之间增加
![leaf](/docbook/includes/images/freemind/leaf.png)
<font metrics-file="C:/Apps/fonts/simsun.xml"
embed-file="C:/Apps/fonts/simsun.ttc" kerning="yes">
<font-triplet name="SimSun" style="normal" weight="normal"/>
<font-triplet name="SimSun" style="normal" weight="bold"/>
<font-triplet name="SimSun" style="italic" weight="normal"/>
<font-triplet name="SimSun" style="italic" weight="bold"/>
</font>
<font metrics-file="C:/Apps/fonts/simhei.xml"
embed-file="C:/Apps//fonts/simhei.ttf" kerning="yes">
<font-triplet name="SimHei" style="normal" weight="normal"/>
<font-triplet name="SimHei" style="normal" weight="bold"/>
<font-triplet name="SimHei" style="italic" weight="normal"/>
<font-triplet name="SimHei" style="italic" weight="bold"/>
</font>
embed-file="C:/Apps/fonts/simsun.ttc" kerning="yes">
<font-triplet name="SimSun" style="normal" weight="normal"/>
<font-triplet name="SimSun" style="normal" weight="bold"/>
<font-triplet name="SimSun" style="italic" weight="normal"/>
<font-triplet name="SimSun" style="italic" weight="bold"/>
</font>
<font metrics-file="C:/Apps/fonts/simhei.xml"
embed-file="C:/Apps//fonts/simhei.ttf" kerning="yes">
<font-triplet name="SimHei" style="normal" weight="normal"/>
<font-triplet name="SimHei" style="normal" weight="bold"/>
<font-triplet name="SimHei" style="italic" weight="normal"/>
<font-triplet name="SimHei" style="italic" weight="bold"/>
</font>