1

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

不幸的是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>
4

1 回答 1

1

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

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

class="- 主题/链接 mylink-d/mylinktype "

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

于 2016-01-14T15:45:48.287 回答