【问题标题】:How can I specialize the link element (related-links)如何专门化链接元素(相关链接)
【发布时间】:2016-04-18 09:51:24
【问题描述】:

我想基于link 元素创建新元素。这对作者来说会比使用roleotherrole 属性来指定链接角色更舒服。

不幸的是,DITA-OT 2.2.1 失败并显示此消息:

    Required item type of result of template related-links:link. 
    is element(Q{}link); supplied value has item type
    element(Q{}myelement)

这是一种有效的方法,还是我应该坚持otherrole

更新 1: 错误发生在related-links.xsl:

<!-- Ungrouped links have the default-mode 
     template applied to them. (Can be overridden.) -->
<xsl:template match="*[contains(@class, ' topic/link ')]" 
              mode="related-links:link" 
              name="related-links:link."
              as="element(link)">
  <xsl:sequence select="."/>   <!--- error points to this line -->
</xsl:template>

【问题讨论】:

  • 能否也贴出XSLT模板+出现问题的行?如果问题一致,也许您可​​以在 DITA OT 错误列表中添加错误。
  • 此行导致错误beetle.dita#L23
  • 两种变体都不起作用:-&lt;!ATTLIST hyponym %global-atts; class CDATA "- topic/link "&gt;-&lt;!ATTLIST hyponym %global-atts; class CDATA "- topic/link termentry/hypernym"&gt;

标签: dita dita-ot


【解决方案1】:

这显然是 XSLT 实现中的一个错误,因为您不能对任何 DITA 处理使用直接标记名检查,因为正如您所看到的那样,它会在专业化面前失败。

附注:假设您的专业是域,根据 DITA 命名约定,域的名称应以“-d”结尾:

class="-topic/link mylink-d/mylinktype"

这是一个约定,不是硬性要求,但能够查看@class 值并了解元素是来自域还是结构特化很有用。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-02
  • 2011-10-06
  • 2011-03-05
  • 1970-01-01
相关资源
最近更新 更多