整理在翻译与校对Spring 2.0 Reference时使用DocBook时的技巧与注意点

整理在翻译与校对Spring 2.0 Reference时使用DocBook时的技巧与注意点

一、XML文件的编辑与校对

翻译校对时,在XML文件头前增加:
[code]
<!DOCTYPE chapter SYSTEM "../lib/docbook-dtd/docbookx.dtd">
<?xml-stylesheet type="text/xsl" href="../styles/fopdf.xsl" mce_href="../styles/fopdf.xsl"?>
[/code]
提交前把这两行删除,以保证XML的合式,并可以实时用浏览器查看最终的结果并进行调整。

二、段落首行缩进两个字符
通常中文文档的段落首行会缩进两个字符。
HTML版本的输出在styles/html.css样式表里面增加样式定义即可,注意build时html.css也要拷贝过去,要不然,无效果,如下:
[code]
P
{
text-indent: 2em;
}
[/code]
用FOP转换成PDF时可以通过设置param.xsl的参数。
方法是:在<xsl:attribute-set name="normal.para.spacing">中增加属性<xsl:attribute name="text-indent">2em</xsl:attribute>
变成如下即可:
[code]
<xsl:attribute-set name="normal.para.spacing">
<xsl:attribute name="text-indent">2em</xsl:attribute>
<xsl:attribute name="space-before.optimum">1em</xsl:attribute>
<xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
<xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
</xsl:attribute-set>
[/code]
三、编译生成.chm文件
先利用DocBook及xsltproc来生成.hhp和.hhc文件以及所需的.html文件,然后利用hhc.exe来编译即可
命令如下:
[code]
C:\OpenDoc\Libxml\bin\xsltproc --output C:\OpenDoc\Spring\Reference\spring2rc2_zh_cn\dist\ C:\OpenDoc\DocBook\htmlhelp\htmlhelp.xsl C:\OpenDoc\Spring\Reference\spring2rc2_zh_cn\src\index.xml
[/code]
由于要处理中文的问题,需要配置如下参数,下面对DocBook一些配置参数一些说明:
1、chunker.xsl中的
[code]
<xsl:param name="chunker.output.method" select="'html'"/><!-- -->
<xsl:param name="chunker.output.encoding" select="'ISO-8859-1'"/><!-- 输出的html中的text/html; charset=值 -->
<xsl:param name="chunker.output.indent" select="'yes'"/><!-- 输出的html会换行 -->
<xsl:param name="chunker.output.omit-xml-declaration" select="'no'"/>
<xsl:param name="chunker.output.standalone" select="'no'"/>
<xsl:param name="chunker.output.doctype-public" select="''"/>
<xsl:param name="chunker.output.doctype-system" select="''"/>
<xsl:param name="chunker.output.media-type" select="''"/>
<xsl:param name="chunker.output.cdata-section-elements" select="''"/>

<xsl:param name="saxon.character.representation" select="'native'"/><!-- 对于非ASCII码,按本地字符形式显示。缺省为entity;decimal,这样会把非ASCII码显示为数字实体的形式。可以用native来显示本地字符形式 -->
[/code]
2、param.xsl中的
[code]
<xsl:param name="html.stylesheet" select="'styles/html.css'"/><!-- 使用css层式表 -->
<xsl:param name="l10n.gentext.language" select="'zh_cn'"/><!-- 生成的网页会使用中文习惯,如使用“目录”不用“Table of Content”,用“下一页”不用“Next”,用“章”不用“Chapter”,用“部分”不用“Part”,等等 -->
<xsl:param name="htmlhelp.encoding" select="'GBK'"/><!-- 生成.hhp及.hhc的编码,默认为iso-8859-1 -->

<xsl:param name="l10n.gentext.default.language" select="'en'"/><!-- -->

<xsl:param name="htmlhelp.chm" select="'Spring_2.0_Reference_zh_CN.chm'"/><!-- 编译生成.chm的文件名 -->

<xsl:param name="section.autolabel" select="0"/><!-- -->
<xsl:param name="section.label.includes.component.label" select="0"/><!-- -->
[/code]
再用Microsoft HTML Help Workshop工具里的hhc.exe程序里命令行工具,hhw.exe为图形化操作界面,大家可能都比较熟悉了。
利用它们都可以进行编译chm文件。hhc.exe命令格式如下:
Usage: hhc <filename>
where <filename> = an HTML Help project file
Example: hhc myfile.hhp
如:hhc dist\htmlhelp.hhp
这样就可以编译出 Spring_2.0_Reference_zh_CN.chm 文件了,重要的是编辑出来的.chm可以进行中英文的搜索与正常的字符拷贝等。

四、其它继续整理总结中。。。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值