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

Cross-references to topics containing <shortdesc> elements with cross-references sometimes get link descriptions of *** #4244

Closed
chrispy-snps opened this issue Jul 18, 2023 · 0 comments · Fixed by #4266
Milestone

Comments

@chrispy-snps
Copy link
Contributor

chrispy-snps commented Jul 18, 2023

Expected Behavior

When a cross-reference exists in topic 1 to topic 2, and topic 2's <shortdesc> contains a second-level <xref> to topic 3:

4244

the link description for topic 1's cross-reference should be computed in the usual way by applying templates to topic 2's <xref> element.

Actual Behavior

In topicpullImpl.xsl, if topic 2's <xref> contains a / character, then the <xsl:otherwise> code branch is taken:

  <xsl:template match="*[contains(@class,' topic/xref ')]" mode="copy-shortdesc">
    <xsl:choose>
...omitted...
      <xsl:when test="not(contains(@href,'/'))"><!-- May be DITA, but in the same directory -->
        <xsl:copy>
          <xsl:apply-templates select="@*|text()|*" mode="#current" />
        </xsl:copy>
...omitted...
      <xsl:otherwise>
        <xsl:text>***</xsl:text><!-- go get the target text -->
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

and the link text for topic 2's <xref> resolves to *** in topic 1's cross-reference link description, as shown by the following HTML:

<p class="p"><a class="xref" href="topic2.html" title="Topic 2 reference to topic 3: ***">topic2 Title</a></p>

Possible Solution

Reconsider how the <xsl:choose> tests are performed.

Steps to Reproduce

  1. Download the following testcase: 4244.zip
  2. Run the following command: dita -i map.ditamap -f html5

Here is the instrumented topicpullImpl.xsl I used to debug this: topicpullImpl.xsl.zip

Environment

  • DITA-OT version: 4.1
  • Operating system and version: Linux (Ubuntu 22.04 LTS)
  • How did you run DITA-OT? dita command
  • Transformation type: HTML5
@chrispy-snps chrispy-snps changed the title Cross-references to topics containing <shortdesc> elements with cross-references sometimes get link descriptions of ***` Cross-references to topics containing <shortdesc> elements with cross-references sometimes get link descriptions of *** Jul 18, 2023
@jelovirt jelovirt added this to the Next milestone Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants