You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在DITA Map中链接子Map而不嵌入其内容?

怎么让DITA主Map只链接子Map不嵌入内容?

默认用<mapref>引用子Map时,DITA-OT会把子Map里的内容直接合并到主Map的发布输出里。要改成只生成链接不嵌入,调整<mapref>的属性就行:

直接修改方法

给<mapref>加上scope="external"属性,告诉发布引擎这个子Map是外部资源,只做链接处理。修改后的代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
    <title></title>
    <mapref href="catalog.ditamap" format="ditamap" scope="external"/>
    <topicref href="whats-new.dita" format="dita"/>
    <topicref href="quality.dita" format="dita"/>
    <topicref href="distribution.dita" format="dita"/>
    <topicref href="guide.dita" format="dita"/>
    <topicref href="feedback.dita" format="dita"/>
</map>

额外注意点

  • scope="external"的核心作用就是标记该引用为外部资源,发布时只会生成指向子Map输出文件的链接,不会把子Map的内容合并到主输出中。
  • 要单独发布catalog.ditamap生成对应的输出文件(比如HTML、PDF),否则主输出里的链接会找不到目标文件。
  • 如果需要指定链接的输出格式,可以配合format属性(比如format="html"),不过一般保持format="ditamap"即可,DITA-OT会自动匹配对应的输出格式。

内容的提问来源于stack exchange,提问作者ianmayo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 13:25:01