Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when determining the label for entries in Bibliography #479

Open
fsteimke opened this issue Feb 24, 2024 · 0 comments
Open

Error when determining the label for entries in Bibliography #479

fsteimke opened this issue Feb 24, 2024 · 0 comments

Comments

@fsteimke
Copy link
Contributor

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.

xnachweis.zip

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:

  1. the first node is an db:abbrev element, or
  2. the first node is a text node which, when normalized, is equal to the empty string, and the second node is an db:abbrev element

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant