最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】把Docbook默认输出的单个HTML文件,改为输出多个的HTML文件

Docbook crifan 2282浏览 0评论

【问题】

docbook已经折腾了不少东西了,但是都在忙pdf方面的。

现在开始回来折腾HTML方面的。

对于默认输出的HTML,之前看到的解释,应该就是多个HTML才对。

然后对应的单个HTML是XHTML才对。

但是结果,我这默认输出的HTML是单个的文件:MPEG_VBR.html。效果如下:单个html

现在想要让其输出为多个HTML的那种效果。

 

【解决过程】

1.参考官网的解释:Chunking into multiple HTML files,去更改了对应配置。

先是参照原先的html的配置,自己写了个配置文件chunk_crl.xsl:

<?xml version='1.0'?>

<!DOCTYPE stylesheet 
[

<!ENTITY xsl_ns_base_dir "/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.76.1">
<!-- <!ENTITY xsl_ns_base_dir "/cygdrive/e/Dev_Root/docbook/tools/docbook-xsl-ns-1.76.1"> -->

]
>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version='1.0'>

<xsl:import href="&xsl_ns_base_dir;/html/chunk.xsl"/>

<xsl:output method="html"
            encoding="UTF-8"
            indent="no"/>

<xsl:param name="title.font.family">msyhbd</xsl:param>
<xsl:param name="body.font.family">msyh</xsl:param>
<xsl:param name="monospace.font.family">msyh</xsl:param>

<!--============================================================================
misc setting
=============================================================================-->
<xsl:param name="section.autolabel" select="1"/>
<xsl:param name="section.label.includes.component.label" select="1"/>
<xsl:param name="bibliography.numbered" select="1"/>

</xsl:stylesheet>

然后再去试试,结果就可以生成了:

CLi@PC-CLI-1 ~/develop/docbook/books/VBR/VBR/src
$ XML_CATALOG_FILES="/home/CLi/develop/docbook/config/catalog/catalog.xml" \
>    xsltproc.exe --xinclude -o ../output/html/multi/MPEG_VBR.html chunk_html_crl.xsl MPEG_VBR.xml
Writing pr01s02.html for section
Writing pr01.html for preface(preface)
Writing ch01s02.html for sect1
Writing ch01s03.html for sect1
Writing ch01s04.html for sect1
Writing ch01s05.html for sect1
Writing ch01.html for chapter(ch1_mpeg_related)
Writing ch02s02.html for sect1
Writing ch02s03.html for sect1
Writing ch02s04.html for sect1
Writing ch02s05.html for sect1
Writing ch02s06.html for sect1
Writing ch02s07.html for sect1
Writing ch02s08.html for sect1
Writing ch02.html for chapter(ch2_mp3_term.xml)
Writing ch03s02.html for sect1
Writing ch03s03.html for sect1
Writing ch03.html for chapter(ch3_mpeg_frame.xml)
Writing ch04s02.html for sect1
Writing ch04.html for chapter(ch4_xing_vbri.xml)
Writing ch05s02.html for sect1
Writing ch05s03.html for sect1
Writing ch05.html for chapter(ch5_calc_duration.xml)
Writing ch06s02.html for sect1
Writing ch06s03.html for sect1
Writing ch06s04.html for sect1
Writing ch06.html for chapter(ch6_mp3_related.xml)
Writing ch07.html for chapter(ch7_after_content.xml)
Writing bi01.html for bibliography(reference)
Writing index.html for book

对应的效果如下:

生成了多个html

然后打开index.html后, 点击下一页,也是正常的:

多个html的第二页

【总结】

想要生成多个html文件,主要是把默认的html的docbook.xsl换为chunk.xsl即可。

转载请注明:在路上 » 【已解决】把Docbook默认输出的单个HTML文件,改为输出多个的HTML文件

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.174 seconds, using 22.11MB memory