HTML5 output: duplicated title and h1 tags
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 7
- Joined: Mon Jan 08, 2018 9:39 pm
HTML5 output: duplicated title and h1 tags
Hi, when I run an HTML5 transform on my content, I'm getting the DITA topic title twice in the output: once as a title tag in the resulting HTML topic, and once as an identical H1 tag outside of the head tag.
Is there anyway to suppress this? The title is sufficient in our situation, so the initial h1 is redundant. I've tried this in Oxygen and a pure DITA-OT transform, so it's not specifically an Oxygen question, but it would be nice to be able to control this.
Thanks,
Mike
Is there anyway to suppress this? The title is sufficient in our situation, so the initial h1 is redundant. I've tried this in Oxygen and a pure DITA-OT transform, so it's not specifically an Oxygen question, but it would be nice to be able to control this.
Thanks,
Mike
-
- Posts: 9420
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HTML5 output: duplicated title and h1 tags
Hi Mike,
Maybe you can add to the HTML5 transformation your custom CSS stylesheet to set display:none on that <h1> containing the title.
Otherwise if you want that <h1> to be removed from the HTML file you would either need to create a custom HTML customization plugin which tries to override the XSL template producing that <h1> or maybe perform some post-processing (maybe regexp based) on the output folder and remove it.
Regards,
Radu
Maybe you can add to the HTML5 transformation your custom CSS stylesheet to set display:none on that <h1> containing the title.
Otherwise if you want that <h1> to be removed from the HTML file you would either need to create a custom HTML customization plugin which tries to override the XSL template producing that <h1> or maybe perform some post-processing (maybe regexp based) on the output folder and remove it.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: HTML5 output: duplicated title and h1 tags
Hi Mike,
In addition of what Radu already suggested, I just wanted to clarify that the title element from the header of an HTML document does not appear in the content, as it is part of the HTML metadata that is not visible.
It is only used to display the title of the page on a browser tab, or in the title bar of a window, not in the canvas area.
However, if you specifically need to remove the title from the header of the visible HTML content, you could do this easily, hiding it through a CSS:display rule, in your own customization CSS, like Radu also mentioned.
For example, in your custom CSS, you should use something like:
This should hide the very first header title from each HTML document from your published output.
In the same manner you could hide or style any other elements from your output. All you have to do is use your browser's CSS inspector to identify the specific selector you should use in your CSS, then apply your own properties.
To use a custom CSS, you could pass the .css file into the "args.css" parameter from the "Parameters" tab of the transformation scenario you are using.
Additionally, if in the list of parameters there is also a "args.copycss" parameter, you should set it to "yes".
I hope this helps.
Regards,
Costin
In addition of what Radu already suggested, I just wanted to clarify that the title element from the header of an HTML document does not appear in the content, as it is part of the HTML metadata that is not visible.
It is only used to display the title of the page on a browser tab, or in the title bar of a window, not in the canvas area.
However, if you specifically need to remove the title from the header of the visible HTML content, you could do this easily, hiding it through a CSS:display rule, in your own customization CSS, like Radu also mentioned.
For example, in your custom CSS, you should use something like:
Code: Select all
h1.title {
display: none !important;
}
In the same manner you could hide or style any other elements from your output. All you have to do is use your browser's CSS inspector to identify the specific selector you should use in your CSS, then apply your own properties.
To use a custom CSS, you could pass the .css file into the "args.css" parameter from the "Parameters" tab of the transformation scenario you are using.
Additionally, if in the list of parameters there is also a "args.copycss" parameter, you should set it to "yes".
I hope this helps.
Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
-
- Posts: 7
- Joined: Mon Jan 08, 2018 9:39 pm
Re: HTML5 output: duplicated title and h1 tags
Thanks, Radu and Costin, for the suggestions. The issue is that we're pulling the HTML content into another system for publishing it to its audience, and that system uses the title to generate a visible heading. So we're getting the heading twice.
I think the solution that Radu mentioned, using a regular expression to delete the h1 content before uploading it to the server, is the solution. It's a little odd that there's no easy way to suppress the h1 from being generated, but it's not the first odd thing about the DITA-OT.
Thanks.
I think the solution that Radu mentioned, using a regular expression to delete the h1 content before uploading it to the server, is the solution. It's a little odd that there's no easy way to suppress the h1 from being generated, but it's not the first odd thing about the DITA-OT.

Thanks.
-
- Posts: 9420
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HTML5 output: duplicated title and h1 tags
Hi,
What you want is not something very usual so there is no parameter to control it.
If you want to do this the proper way, you could create a DITA Open Toolkit plugin which adds a new transformation type based on HTML5. Your new plugin will add an XSLT customization which would override from the base HTML5 plugin the XSLT template which outputs the <h1>.
In the XSLT OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT2.x/plugins/org.dita.html5/xsl/topic.xsl there is an XSLT template:
which I think is the one responsible for creating those headings. You could override it in your XSLT customization to avoid generating the <h1> for the top level topics.
Regards,
Radu
What you want is not something very usual so there is no parameter to control it.
If you want to do this the proper way, you could create a DITA Open Toolkit plugin which adds a new transformation type based on HTML5. Your new plugin will add an XSLT customization which would override from the base HTML5 plugin the XSLT template which outputs the <h1>.
In the XSLT OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT2.x/plugins/org.dita.html5/xsl/topic.xsl there is an XSLT template:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/title ')]">
....
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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