Removing the XML or DOCTYPE declaration at the top of each output page

For most of the output formats, HTML documents are generated with simple XML declaration inserted at the beginning of each file. That line looks like this:

<?xml version="1.0" encoding="utf-8"?>

Most systems have no problem processing, storing, or displaying XML documents. However, if you need to remove that declaration for any reason, a simple override is available that will allow it.

You should be able to get the results you are looking for by modifying the XSL responsible for creating the output pages. For Dynamic HTML, the files you will want to override are located in your ePublisher Pro installation directory, by default here: C:\Program Files\WebWorks\ePublisher Pro\Formats\Dynamic HTML\Transforms\

The files are: pages.xsl toc.xsl index.xsl

Copy each file into your project directory, reproducing the appropriate directory structure for a format or target override. Then, open each one in a text editor such as NotePad. In each file, search for the following string:

<xsl:variable name="VarWriteResult"

That's the line where the XML is written to a text document. The Document() function in that line contains an argument for omitting the XML declaration at the top of each page. Within that string, you'll see this: 'yes','no','no'

Change that to: 'yes','yes','no'

Then, if you need to also delete the DOCTYPE declaration in the HTML files, also remove the last two arguments on that line. So, you should end up with something like this: <xsl:variable name="VarWriteResult" select="wwexsldoc:Document($VarResult, $ParamSplit/@path, wwprojext:GetFormatSetting('encoding', 'utf-8'), 'xhtml', '1.0', 'yes', 'yes', 'no')" />

Save each file, and regenerate output to apply the changes. That should leave you with just the starting <html> tag in your output files.


CategorySolutionsOutputShared

LaurenLever/@Solutions/Output/Removing XML Declaration (last edited 2009-06-02 19:34:58 by LaurenLever)