DocBook XSL - 可以编辑原始样式表吗?
我想根据特定的 是否定义了某个属性,将 DocBook 目录的某些行粗体。通过将
语句添加到 DocBook XSL 中(fo/autotoc.xsl 第 187-230 行——用于输出到 PDF),这很容易使用 XMLMind)。
不过,我想知道自行编辑 DocBook XSL 是否是一种不好的做法。我在自己的单独 XSL 中进行了其他自定义,主要是设置参数,但我无法想象如何引入此条件逻辑(基于当前正在处理 TOC 的哪一行)而不放置某种代码在原作中。有什么想法吗?进行更改后如何升级到较新的 DocBook XSL?
I would like to make certain lines of a DocBook table of contents bold based on whether the particular <section>
has a certain attribute defined. This is easy by adding an <xsl:if test="...">
statement to the DocBook XSL (fo/autotoc.xsl lines 187-230 -- this is for output to PDF using XMLMind).
I'm wondering, though, if it's bad practice to edit the DocBook XSLs themselves. I have other customizations in a separate XSL of my own, mostly setting parameters, but I can't imagine how I would introduce this conditional logic--based on which line of the TOC is currently being processed--without putting some sort of code in the originals. Any thoughts? How do you upgrade to a newer DocBook XSL after making changes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从您自己的 XSLT 导入 docbook 样式表。然后,(重新)定义您想要“覆盖”的 Docbook 模板。
由于您的模板将位于导入树中的最高位置,因此它将优先。
通过这种方式,您不必修改任何核心 docbook XSLT 文件。它将使将来 Docbook 样式表的升级变得更加容易。
Import the docbook stylesheets from your own XSLT. Then, (re)define the Docbook template that you want to "override".
Since your template will be the highest in the import tree, it will take precedence.
By doing it that way you don't have to modify any of the core docbook XSLT files. It will make upgrades of the Docbook stylesheets easier in the future.