removing the <?xml ... header

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
rdelong
Posts: 71
Joined: Tue Oct 21, 2014 10:01 pm

removing the <?xml ... header

Post by rdelong » Thu Jul 13, 2017 9:11 pm

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?

rdelong
Posts: 71
Joined: Tue Oct 21, 2014 10:01 pm

Re: removing the <?xml ... header

Post by rdelong » Thu Jul 13, 2017 9:12 pm

I should mention that we are still using DITA-OT 1.8.5, not 2.x.

Radu
Posts: 6380
Joined: Fri Jul 09, 2004 5:18 pm

Re: removing the <?xml ... header

Post by Radu » Fri Jul 14, 2017 7:47 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

rdelong
Posts: 71
Joined: Tue Oct 21, 2014 10:01 pm

Re: removing the <?xml ... header

Post by rdelong » Mon Jul 17, 2017 6:55 pm

Omitting the XML declaration did the trick!

Thanks

Post Reply