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

ID attribute is lost on a title element from a section #3612

Open
raducoravu opened this issue Oct 16, 2020 · 7 comments
Open

ID attribute is lost on a title element from a section #3612

raducoravu opened this issue Oct 16, 2020 · 7 comments
Labels
bug plugin/html5 Issue related to HTML5 plug-in priority/medium Medium (or unknown) priority issue

Comments

@raducoravu
Copy link
Member

raducoravu commented Oct 16, 2020

If I have a DITA section with a title element inside and the title element has an @id attribute, that ID attribute is not propagated to the XHTML output.
Some samples can be found here.
In the XSLT stylesheet DITA-OT3.x/plugins/org.dita.html5/xsl/topic.xsl there is a template:

    <xsl:template match="*[contains(@class, ' topic/section ')]/*[contains(@class, ' topic/title ')] | 
      *[contains(@class, ' topic/example ')]/*[contains(@class, ' topic/title ')]" name="topic.section_title">
      <xsl:param name="headLevel">
      <xsl:variable name="headCount" select="count(ancestor::*[contains(@class, ' topic/topic ')])+1"/>
      <xsl:choose>
        <xsl:when test="$headCount > 6">h6</xsl:when>
        <xsl:otherwise>h<xsl:value-of select="$headCount"/></xsl:otherwise>
      </xsl:choose>
    </xsl:param>
    <xsl:element name="{$headLevel}">
      <xsl:attribute name="class">sectiontitle</xsl:attribute>
      <xsl:call-template name="commonattributes">
        <xsl:with-param name="default-output-class" select="'sectiontitle'"/>
      </xsl:call-template>
      <xsl:apply-templates/>
    </xsl:element>
     </xsl:template>

which before calling "commonattributes" should also call:

     <xsl:call-template name="setid"/>
@jelovirt jelovirt added bug plugin/html5 Issue related to HTML5 plug-in priority/medium Medium (or unknown) priority issue labels Oct 16, 2020
@shaurabhprakash
Copy link

I facing same issue for PDF output with DITA-OT 3.5.4 version. Any suggestions to handle it will be helpful.

Thanks,
Shaurabh

@shaurabhprakash
Copy link

In below dita sample, 1st p element consists of xref which is targeting to last p element. But in pdf output file, link does not propagate to respective target.

Dita sample :

<topic xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" id="id_356"
class="- topic/topic " ditaarch:DITAArchVersion="1.3">
<title class="- topic/title ">collection conkeyref</title>
<body class="- topic/body ">
    <bodydiv id="ckref-bodydiv">
        <p id="ckref-2" class="- topic/p ">there is relative link #./id to the paragraph below<xref format="dita"
            href="#./ckref-1" class="- topic/xref ">relative link to previous paragraph</xref></p>
        <p class="- topic/p ">this is a paragraph 1.</p>
        <p class="- topic/p ">this is a paragraph 2.</p>
        <p id="ckref-1" class="- topic/p ">this is a target link of the above hyperlink</p>
    </bodydiv>
</body>

@MarvinNorway
Copy link

Any update on this?
I think we are facing the same issue with PDF generation:
A table is converted to fo:block without an ID. So our xref doesn't find the element and the link in the PDF does not work.
Strangely, it works for other tables.

@raducoravu
Copy link
Member Author

@MarvinNorway is it possible you have a PDF customization folder or plugin which may be responsible for this? Can you test this also without the PDF customization?

@MarvinNorway
Copy link

@raducoravu Wow, that was quick. I have found out that the "scale" attribute on the table is causing the ID to omitted from the .fo output. Without the "scale" attribute, it works fine. But this is an older DITA-OT version.
Does that ring a bell?

@raducoravu
Copy link
Member Author

@MarvinNorway I tested with DITA OT 3.7, maybe you can also test with it, I had a DITA table with and without @scale, looked in the XSL-FO output and there is an ID attribute there based on the original ID attribute of the table, so if your XSL-FO output does not have an ID attribute for the fo:block generated from the table, either this was some kind of bug in an older DITA OT version or you may have a PDF customization inducing this problem.

@MarvinNorway
Copy link

@raducoravu Thank you. I have spoken to the client and they actually don't use it, the attribute was added accidentally.
So I don't really have more time to research this, especially as we are using a very old DITA-OT version. I will just assume it has been fixed in the meantime. :-)
I really appreciate you looking into this. Sorry for wasting your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug plugin/html5 Issue related to HTML5 plug-in priority/medium Medium (or unknown) priority issue
Projects
None yet
Development

No branches or pull requests

4 participants