Error when determining the label for entries in Bibliography
I found an issue with the attached source document. Maybe i know how to fix it, but i don't understand the reason for the issue.
The document contains a bibliography. Entries are referenced with citation. Transforming it to HTML with the recent release 2.2.0 shows that citationelements became a links to the biblioentry, which is correct. But I would expect the value of bibliomixed/abbrev as link content., Instead i find a label that is obviously generated by the stylesheets: "R_bi1_bibliomixed1" instead of "EU-TDD".
I am pretty sure that this is caused by the following template which is located at line 147 in xref.xsl:
<xsl:template match="db:bibliomixed|db:biblioentry" mode="m:crossref-label">
<xsl:choose>
<xsl:when test="node()[1]/self::db:abbrev
or (node()[1]/text()
and normalize-space(node()[1]) = ''
and node()[2]/self::db:abbrev)">
<xsl:apply-templates select="db:abbrev[1]"/>
</xsl:when>
<xsl:when test="@xml:id">
<xsl:value-of select="@xml:id"/>
</xsl:when>
<xsl:otherwise>
<xsl:next-match/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
The first branch checks, if for a given biblioentry or bibliomixed element one of the following conditions holds:
- the first node is an
db:abbrevelement, or - the first node is a text node which, when normalized, is equal to the empty string, and the second node is an
db:abbrevelement
This check fails with the bibliomixed elements from the attached document, but i don't understand the reason. Debugging with <xsl:message /> indicates that:
- the
string-length(normalize-space(node[1])))for the normalized text-content of the first node (which is indeed a text-node) is zero; but - comparing the normalized text-content to the empty string results in
false().
This is what confuses me: the string-length is 0, but it is not equal to the empty string?
However, i think that the first check can be simplified to *[1]/self::db:abbrev (is the first element-node an db:abbrev element?).
I will make a pull request with this expression. Test ran successfully at my system.
Greetings, Frank