我正在尝试自定义 DocBook XSL 的 HTML 输出。
<section>
级别 X 生成标题级别 X + 1。
例如<sect1>
-><h2>
但我使用<section>
标签,而不是<sectX>
. 我理解它发生的原因,但我想改变这种行为,以便给定级别的部分生成相同的级别标题。我尝试研究标题页模板,但它们对我来说并没有什么意义,而且我找不到生成<hX>
标签的实际代码。
例如,我有一个看起来像这样的 docbook 文档:
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
[other namespace definitions]
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://docbook.org/ns/docbook docbook.xsd" version="5.0">
<info>
<title>Document Title</title>
<orgname>Company</orgname>
</info>
<section>
<title>INTRODUCTION</title>
<section>
<title>Overview</title>
<para>This document defines [...]</para>
</section>
<section>
<title>More Information</title>
<para>[...]</para>
</section>
<section>
<title>Aim</title>
<para>This Document will be used to [...]</para>
<table>
[irrelevant table code]
</table>
</section>
<section>
<title>Related Documents</title>
<para>[...]</para>
</section>
</section>
<section>
<title>ANOTHER SECTION</title>
<para>This section provides [...]</para>
</section>
</article>
这会生成以下 HTML 代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Document Title</title>
<meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="print.css" type="text/css" media="print">
<!--[if IE]>
<link type="text/css" rel="stylesheet" href="ie.css">
<![endif]-->
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="article" title="Document Title">
<div class="titlepage">
<div>
<div>
<h1 class="title"><a name="d0e1"></a>Document Title</h1>
</div>
</div>
<hr>
</div>
<div class="toc">
<p>
<b>Table of Contents</b>
</p>
<dl>
<dt><span class="section"><a href="#d0e7">INTRODUCTION</a></span></dt>
<dd>
<dl>
<dt><span class="section"><a href="#d0e10">Overview</a></span></dt>
<dt><span class="section"><a href="#d0e15">More Information</a></span></dt>
<dt><span class="section"><a href="#d0e20">Aim</a></span></dt>
<dt><span class="section"><a href="#d0e48">Related Documents</a></span></dt>
</dl>
</dd>
<dt><span class="section"><a href="#d0e53">ANOTHER SECTION</a></span></dt>
</dl>
</div>
<div class="section" title="INTRODUCTION">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="d0e7"></a>INTRODUCTION</h2>
</div>
</div>
</div>
<div class="section" title="Overview">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="d0e10"></a>Overview</h3>
</div>
</div>
</div>
<p>
This document defines [...]
</p>
</div>
<div class="section" title="More Information">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="d0e15"></a>More Information</h3>
</div>
</div>
</div>
<p>
[...]
</p>
</div>
<div class="section" title="Aim">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="d0e20"></a>Aim</h3>
</div>
</div>
</div>
<p>
This Document will be used to [...]
</p>
<div class="table">
[irrelevant table code]
</div>
<br class="table-break">
</div>
<div class="section" title="Related Documents">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a name="d0e48"></a>Related Documents</h3>
</div>
</div>
</div>
<p>
[...]
</p>
</div>
</div>
<div class="section" title="ANOTHER SECTION">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="d0e53"></a>ANOTHER SECTION</h2>
</div>
</div>
</div>
<p>
This section provides [...]
</p>
</div>
</div>
</body>
</html>
谢谢!
~斯兰皮斯科