Topics

Closing void elements in HTML5 (writing HTML5 serialized as XML) #HTML5

Chris Papademetrious
 

Hi all,

I have a similar requirement - to write XML-serialized HTML5 for consumption by a downstream processing tool.

I found the current HTML-serialization settings in the following org.dita.html5 files:

$ fgrep 'xsl:output' -r ./org.dita.html5
./org.dita.html5/xsl/dita2html5.xsl:  <xsl:output method="html"
./org.dita.html5/xsl/map2html5-cover.xsl:  <xsl:output method="html"

and if I manually edit these DITA-OT files to

<xsl:output xmlns:dita="http://dita-ot.sourceforge.net" method="xml" encoding="UTF-8" indent="no"/>

then I get XML-serialized HTML5, the downstream tool consumes everything, and life is good!

But I can't figure out how to convert these manual edits to a DITA-OT plugin. Is there an extension point (or some other mechanism) that lets me override the settings in the two highlighted files above?

Thanks!

 - Chris

Chris Papademetrious
 

I don't think xsl:output can be overridden from a plugin. According to the precedence description in section 26 at


and the import precedence rules at


the top-level module will always win over the imported modules (I think).

 - Chris

Radu Coravu
 

Hi Chris,

Indeed probably a simple DITA OT customization plugin cannot override this setting.
You would need a DITA OT plugin which adds a custom XHTML5 transtype which has its own top-level XSLT stylesheet importing the HTML5 one:

<xsl:import ref="plugin:org.dita.html5:xsl/dita2html5Impl.xsl"/>
and then declaring the xsl:output. That's how we do things for our WebHelp responsive output.

Or in the tool which consumes the HTML5 output add some pre-processing stage using an HTML to XHTML convertor like HTMLTidy or Neko HTML.

Regards,
Radu

Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

On 2/23/2020 3:15 AM, Chris Papademetrious wrote:
I don't think xsl:output can be overridden from a plugin. According to the precedence description in section 26 at
https://www.w3.org/TR/xslt-30/#serialization
and the import precedence rules at
https://www.w3.org/TR/xslt-30/#import
the top-level module will always win over the imported modules (I think).
 - Chris