Page 1 of 1

removing the <?xml ... header

Posted: Thu Jul 13, 2017 9:11 pm
by rdelong
Our doc server configuration was recently updated to allow HTML files (.html) to parse PHP code. As a result, the html header, "<?xml version="1.0" encoding="UTF-8"?>" is causing http 500 errors. Is there a way to remove this header from the XHTML transform?

Re: removing the <?xml ... header

Posted: Thu Jul 13, 2017 9:12 pm
by rdelong
I should mention that we are still using DITA-OT 1.8.5, not 2.x.

Re: removing the <?xml ... header

Posted: Fri Jul 14, 2017 7:47 am
by Radu
Hi,

The brute force attach would be to create your custom ANT build file:

https://www.oxygenxml.com/doc/versions/ ... -file.html

which calls the XHTML transformation then at the end goes through each HTML document in the output folder and uses regular expressions to remove that header:

https://ant.apache.org/manual/Tasks/replaceregexp.html

Otherwise you may want to try creating an XHTML plugin XSLT customization and your custom.xsl would define an xsl:output which omits the XML declaration:

Code: Select all

  <xsl:output method="xml"
encoding="UTF-8"
indent="no"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" omit-xml-declaration="yes"/>
A simple example example of a DITA OT plugin customizing the XHTML output is for example this one:

https://github.com/oxygenxml/dita-embed-html

But I have not tested this, so it might not work.

Regards,
Radu

Re: removing the <?xml ... header

Posted: Mon Jul 17, 2017 6:55 pm
by rdelong
Omitting the XML declaration did the trick!

Thanks