2010-08-26 62 views
2

我喜欢有一个docbook xml文档,其中包含多个目标受众的内容。是否有一个过滤器可以让我过滤掉“高级”用户只需要的东西?针对不同目标受众的Docbook发布

我发明了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> 

回答

2

DocBook没有level属性。也许你的意思是userlevel

如果您正在使用DocBook XSL样式表来转换文档,它们具有内置的对分析(条件文本)的支持。要使用它,你需要

  1. 使用样式表的启用分析-版本(例如使用html/profile-docbook.xsl而不是通常的html/docbook.xsl),并

  2. 指定要通过剖析的属性值parameter(例如,设置profile.userlevelbasic)。

鲍勃·斯泰顿的的DocBook XSL的Chapter 26:完全指南有所有的细节。

+0

非常感谢。我无法想象那个docbook没有这样的东西。 – schoetbi 2010-08-27 20:14:41

0

两种方式,把我的头顶部:

  1. 编写一个简单的脚本,它的level作为参数,并使用XPath或正则表达式,只吐出你想要的XML 。
  2. 编写一个XSLT transformation将会吐出你想要的XML。

(2)更清洁,但(1)写起来可能更快。

+0

我预计docbook已经准备好了,但正如你所说的基本的xslt工作。看到我的其他职位与源代码。谢谢。 – schoetbi 2010-08-26 21:57:50

相关问题