removing the <?xml ... header

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
rdelong
Posts: 61

removing the <?xml ... header

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: 61

Re: removing the <?xml ... header

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: 5585

Re: removing the <?xml ... header

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/19.0/ug-editor/topics/dita-map-use-your-own-build-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: 61

Re: removing the <?xml ... header

Mon Jul 17, 2017 6:55 pm

Omitting the XML declaration did the trick!

Thanks

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 1 guest