针对不同目标受众的文档书出版
我喜欢一份 docbook xml 文档,其中包含适合多个目标受众的内容。是否有一个过滤器可以让我过滤掉仅“高级”用户需要的内容?
level 属性是我发明的,用来表达我的想法。
<?xml version="1.0"?>
<book>
<title lang="en">Documentation</title>
<chapter id="introduction" level="advanced">
<title>Introduction for advanced users</title>
</chapter>
<chapter id="introduction" level="basic">
<title>Introduction for basic users</title>
</chapter>
<chapter id="ch1">
<para level="basic">Just press the button</para>
<para level="advanced">
Go to preferences to set your
needs and then start the process
by pressing the button.
</para>
</chapter>
</book>
I like to have one docbook xml document that has content for several target audiences. Is there a filter that enables me to filter out the stuff only needed for "advanced" users?
The level attribute is invented by me to express what I have in mind.
<?xml version="1.0"?>
<book>
<title lang="en">Documentation</title>
<chapter id="introduction" level="advanced">
<title>Introduction for advanced users</title>
</chapter>
<chapter id="introduction" level="basic">
<title>Introduction for basic users</title>
</chapter>
<chapter id="ch1">
<para level="basic">Just press the button</para>
<para level="advanced">
Go to preferences to set your
needs and then start the process
by pressing the button.
</para>
</chapter>
</book>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
DocBook 没有
level
属性。也许您的意思是用户级别
< /a>?如果您使用 DocBook XSL 样式表来转换文档,它们具有对分析(条件文本)的内置支持。要使用它,您需要
使用支持分析的样式表版本(例如使用
html/profile-docbook.xsl
而不是通常的html/docbook.xsl),并
通过 参数(例如将
profile.userlevel
设置为basic
)。Bob Stayton 的 DocBook XSL:完整指南 的 第 26 章 包含所有内容细节。
DocBook does not have a
level
attribute. Perhaps you meantuserlevel
?If you are using the DocBook XSL stylesheets to transform your documents, they have built-in support for profiling (conditional text). To use it you need to
use the profiling-enabled version of the stylesheet (e.g. use
html/profile-docbook.xsl
instead of the usualhtml/docbook.xsl
), andspecify the attribute values you want to profile on via a parameter (e.g. set
profile.userlevel
tobasic
).Chapter 26 of Bob Stayton's DocBook XSL: The Complete Guide has all the details.
我想到了两种方法:
level
作为参数,并使用 XPath 或正则表达式,只输出您想要的 XML。(2) 更清晰,但 (1) 写起来可能更快。
Two ways, off the top of my head:
level
as a parameter and, using XPath or regular expressions, that only spits out the XML you want.(2) is cleaner, but (1) is probably faster to write up.