我想在DITA中为ditamaps编写自定义xsl

时间:2013-12-20 05:15:38

标签: xslt-1.0 dita

我想为DITA编写自定义xsl。我有三个Dita地图,例如book.ditamapchapter1.ditamapchapter2.ditamap,我想要获取我在此ditamaps中提供的标题。

我的book.ditamap看起来像这样:

<bookmap id="pdfnntd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:bookmap.xsd">

  <booktitle>
    <booklibrary>Books about stuff</booklibrary>
    <mainbooktitle>A book about one thing</mainbooktitle>
  </booktitle>

  <chapter href="chapter1.ditamap" format="ditamap"/>
  <chapter href="chapter2.ditamap" format="ditamap"/>
</bookmap>

我的chapter1.ditamap看起来像这样:

<map id="pdfnnt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLenter code hereocation="urn:oasis:names:tc:dita:xsd:map.xsd">

  <topichead>
    <topicmeta>
      <navtitle>Threads</navtitle>
    </topicmeta>
    <topicref href="task/lesson1.xml" type="task"></topicref>
    <topicref href="task/lesson2.xml" type="task"></topicref>
  </topichead>
 </map>

对于这些ditamaps,我想在DITA中编写自定义xsl。我在你的网站上搜索过,我尝试了一个例子,但DITA只采用了默认的xsl。请帮帮我。

2 个答案:

答案 0 :(得分:1)

我假设你正在寻找为PDF转换创建它。我建议您获取DITA for Practitioners或DITA for Print的副本。你需要做的是创建一个插件来覆盖基础XSL并使用XPATH提取以获取mainbooktitle和topicmeta / title(确切的xpath比我在这里写的更复杂)。

您尚未准确指定要对标题执行的操作,因此很难提出有意义的示例。

HTH。

答案 1 :(得分:0)

DITA for Publishers项目(dita4publishers.sourceforge.net)提供了一个通用的XSLT地图处理框架,您可以使用该框架在地图上进行方便的处理,包括获取主题引用的有效导航标题。 D4P发行版包括一个示例插件net.sourceforge.dita4publishers.graphviz /,它演示了如何在相对简单的过程中使用代码(为导航树或后期索引生成Graphviz图表) DITA地图)。

请务必下载最新的0.9.19候选版本,而不是0.9.18软件包 - 我在获取正式版本0.9.19以及更新的文档等方面落伍,但0.9.19代码已经你想要的许多错误修复。

干杯,

埃利奥特