最新消息:20210917 已从crifan.com换到crifan.org

【已解决】Docbook出错:Error: coref link is broken ->将coref中的linkends改为linkend

Docbook crifan 1389浏览 0评论

【问题】

编译docbook源码生成html和pdf过程中,都出现了一个错误:

Error: coref link is broken:

【解决过程】

1.后来搜索此错误,竟然搜到了我自己的文章:

3.42. PDF中callout不能点击跳转(而HTML中却可以)

其中有这部分代码:

<xsl:template match="d:coref">
  <!-- tricky; this relies on the fact that we can process the "co" that's -->
  <!-- "over there" as if it were "right here" -->
 
  <xsl:variable name="co" select="key('id', @linkend)"/>
  <xsl:choose>
    <xsl:when test="not($co)">
      <xsl:message>
        <xsl:text>Error: coref link is broken: </xsl:text>
        <xsl:value-of select="@linkend"/>
      </xsl:message>
    </xsl:when>

即,当发现co的linkend无效的时候,会提示“Error: coref link is broken:”,并且加上错误的内容。

但是此处broken后面却没有内容了,估计是co的linkend本身就是空的,或已被破坏了。现在就是去找找具体是哪个co。

2.后来发现好像有一个co有点问题:

pdf<coref linkends="co.note.html_pdf" />

由之前的知识得知,此处coref应该用linkend而不是linkends,所以改为:

pdf<coref linkend="co.note.html_pdf" />

后,结果又出现另外的错误:

Error: coref doesn't point to a co: co.note.html_pdf

然后才注意到,原来linkend中的内容,是co的注释部分callout位置的id:co.note.html_pdf,而不是co部分的id:co.html_pdf,所以再去改为:

pdf<coref linkends="co.html_pdf" />

然后就消除了此错误,可以正常生成html和pdf了。

【总结】

如果在coref中错误地使用linkends,则会导致错误“Error: coref link is broken”,解决办法是:

把coref中的linkends改为linkend

详细内容,请参考官网解释:coref

另外注意,coref所引用的id,应该是某个co的id,而不是某个callout的id。否则也会报“Error: coref doesn’t point to a co: co.note.html_pdf”错的。

转载请注明:在路上 » 【已解决】Docbook出错:Error: coref link is broken ->将coref中的linkends改为linkend

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
95 queries in 0.680 seconds, using 23.63MB memory