XSL-FO based PDFs don't include heading tags
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 56
- Joined: Wed Aug 08, 2018 10:23 pm
XSL-FO based PDFs don't include heading tags
We've found that PDFs generated from the XSL-FO approach (e.g., built from the "DITA Map PDF - based on XSL-FO" transformation scenario), and with accessibility enabled, don't include heading tags such as H1, H2, etc. This poses a problem for meeting 508 accessibility standards since screen reader users rely on the heading tags to understand document structure. We did, however, notice that the heading tags are included in PDFs generated from the CSS approach.
It's simple to add the heading tags for topic titles (in the XSL-FO approach) by including a "role" attribute in the attribute set for each level of topic title. For example, for a top level title, you just need to add the following to a customized version of the "topic.title" attribute set:
<xsl:attribute name="role">H1</xsl:attribute>
However, in the case of a section within a topic (i.e., generated from a <section> element in a concept topic), you'd need to write some code to determine the nesting level of the topic that includes the section. Before considering to write that code ourselves, we wanted to check with the Oxygen team to see if there were any plans to do that?
Thanks
It's simple to add the heading tags for topic titles (in the XSL-FO approach) by including a "role" attribute in the attribute set for each level of topic title. For example, for a top level title, you just need to add the following to a customized version of the "topic.title" attribute set:
<xsl:attribute name="role">H1</xsl:attribute>
However, in the case of a section within a topic (i.e., generated from a <section> element in a concept topic), you'd need to write some code to determine the nesting level of the topic that includes the section. Before considering to write that code ourselves, we wanted to check with the Oxygen team to see if there were any plans to do that?
Thanks
-
- Posts: 160
- Joined: Mon Nov 24, 2014 1:49 pm
- Location: Greven/Germany
Re: XSL-FO based PDFs don't include heading tags
rjcbop, there development of the current pdf2 plugin is stale. I have also added some interesting features, like XMP handling and think about forking the plugin. Maybe we can join forces.
stefan-jung.org – Your DITA/DITA-OT XML consultant
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: XSL-FO based PDFs don't include heading tags
Post by julien_lacour »
Hello,
If the join forces leads to an issue on DITA-OT GitHub side, could you add the link here?
It's just for follow-up purpose. Thank you both!
Regards,
Julien
If the join forces leads to an issue on DITA-OT GitHub side, could you add the link here?
It's just for follow-up purpose. Thank you both!
Regards,
Julien
-
- Posts: 56
- Joined: Wed Aug 08, 2018 10:23 pm
Re: XSL-FO based PDFs don't include heading tags
I've found a very simple fix that leverages the get-topic-level code that's included in the DITA OT's version of topic.xsl. Specifically, to add the correct heading level to a section element, you just need to override the template (within topic.xsl) that matches the section title, as follows:
<xsl:template match="*[contains(@class,' topic/section ')]/*[contains(@class,' topic/title ')]">
<fo:block xsl:use-attribute-sets="section.title">
<xsl:variable name="level" as="xs:integer">
<xsl:apply-templates select="." mode="get-topic-level"/>
</xsl:variable>
<xsl:call-template name="commonattributes"/>
<xsl:attribute name="role">
<xsl:value-of select="concat('H',$level+1)"/>
</xsl:attribute>
<xsl:apply-templates select="." mode="customTitleAnchor"/>
<xsl:apply-templates select="." mode="getTitle"/>
</fo:block>
</xsl:template>
This same approach (using the 'level' variable to get the topic level and then adding the @role attribute to specify the heading level) can also be applied to the case of a section element with a @spectitle attribute (instead of a <title> element) and to the case of an example element.
<xsl:template match="*[contains(@class,' topic/section ')]/*[contains(@class,' topic/title ')]">
<fo:block xsl:use-attribute-sets="section.title">
<xsl:variable name="level" as="xs:integer">
<xsl:apply-templates select="." mode="get-topic-level"/>
</xsl:variable>
<xsl:call-template name="commonattributes"/>
<xsl:attribute name="role">
<xsl:value-of select="concat('H',$level+1)"/>
</xsl:attribute>
<xsl:apply-templates select="." mode="customTitleAnchor"/>
<xsl:apply-templates select="." mode="getTitle"/>
</fo:block>
</xsl:template>
This same approach (using the 'level' variable to get the topic level and then adding the @role attribute to specify the heading level) can also be applied to the case of a section element with a @spectitle attribute (instead of a <title> element) and to the case of an example element.
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: XSL-FO based PDFs don't include heading tags
Post by julien_lacour »
Hello,
Could you indicate which tool you are using for checking 508 accessibility standard compliance?
I tried with PAC 2021 and Acrobat internal tool, but, even if the role is missing in the FO file, the checker says nothing about headings.
Regards,
Julien
Could you indicate which tool you are using for checking 508 accessibility standard compliance?
I tried with PAC 2021 and Acrobat internal tool, but, even if the role is missing in the FO file, the checker says nothing about headings.
Regards,
Julien
-
- Posts: 56
- Joined: Wed Aug 08, 2018 10:23 pm
Re: XSL-FO based PDFs don't include heading tags
Hi Julien,
Automated PDF accessibility checkers will not flag the absence of headings, but the absence of headings is something you'll notice if you read the document with a screen reader (such as NVDA). The absence of heading tags means that headings are specified with styling rather than structure, which makes it more difficult for screen reader users to understand the structure of the document. For reference, here is a link to WCAG's guidance on heading tags for PDFs: https://www.w3.org/WAI/WCAG21/Techniques/pdf/PDF9
Regards,
Rich
Automated PDF accessibility checkers will not flag the absence of headings, but the absence of headings is something you'll notice if you read the document with a screen reader (such as NVDA). The absence of heading tags means that headings are specified with styling rather than structure, which makes it more difficult for screen reader users to understand the structure of the document. For reference, here is a link to WCAG's guidance on heading tags for PDFs: https://www.w3.org/WAI/WCAG21/Techniques/pdf/PDF9
Regards,
Rich
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service