我怎样才能专门化 link 元素 (related-links)
How can I specialize the link element (related-links)
我想根据 link 元素创建新元素。这比使用 role
和 otherrole
属性指定 link 角色更方便作者。
不幸的是,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 处理使用直接标记名检查,因为如您所见,它会在面对专业化时失败。
旁注:假设您的专业是域,根据 DITA 命名约定,域的名称应以“-d”结尾:
class="- topic/link mylink-d/mylinktype "
这是一个约定,并非硬性要求,但它有助于查看 @class 值并了解元素是来自域还是结构专业化。
我想根据 link 元素创建新元素。这比使用 role
和 otherrole
属性指定 link 角色更方便作者。
不幸的是,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 处理使用直接标记名检查,因为如您所见,它会在面对专业化时失败。
旁注:假设您的专业是域,根据 DITA 命名约定,域的名称应以“-d”结尾:
class="- topic/link mylink-d/mylinktype "
这是一个约定,并非硬性要求,但它有助于查看 @class 值并了解元素是来自域还是结构专业化。