Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Batch XHTML 1.0 Strict to HTML5 conversion (browser-based and Dreamweaver extension)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 css
Octocat-spinner-32 js
Octocat-spinner-32 tests
Octocat-spinner-32 README.md
Octocat-spinner-32 dw-x2h.htm
Octocat-spinner-32 dw-x2h.mxi
Octocat-spinner-32 index.html
README.md

XHTML 1.0 Strict to HTML5 batch conversion

I came across a situation where I needed to convert a bunch of XHTML 1.0 Strict documents (or snippets) to valid HTML5.
This tool automates the process.

Note that this will not add any new HTML5 elements/features to your pages.
It merely gets rid of deprecated XHTML 1.0 Strict elements/attributes or replaces them with conforming ones.

Usage

There are two "products" in here:

  1. Browser-based, drag-and-drop batch conversion:
    1. Download and extract the files. (or use the demo here)
    2. Visit index.html in Firefox 3.6+ (if you are using Chrome/Chromium, see note below)
    3. Drag/drop your valid XHTML 1.0 Strict files in the marked area.
    4. If everything goes according to plan you'll be asked to download a zip file containing the HTML5 equivalent of your files.
    5. For more information (or if the conversion failed), take a look at the "Output" area. Messages will be added there as the files are processed.
  2. Dreamweaver extension
    1. Open "dw-x2h.mxi" with the "Adobe Extension Manager"
    2. Access 'XHTML to HTML5' entry in the 'Commands' menu
    3. Select the folder containing your XHTML files
    4. Wait while DW converts the files
    5. At the end, you'll be left with an opened document containing notes and information on the conversion, if applicable.

What exacly does this do to my documents?

  • Replaces <acronym> with <abbr>
  • Replaces <big> with <span class="big">
  • Replaces <tt> with <span class="tt">
  • Removes @summary from <table>
  • Replaces @cellpadding/@cellspacing with a class (ex: class="cellpadding5" instead of cellpadding="5") on <table>
  • Removes @nohref from <area>
  • Removes @profile from <head>
  • Removes @archive, @classid, @codebase, @codetype, @declare, @standby from <object>
  • Removes @type and @valuetype from <param>
  • Removes @charset, @name, @rev and @shape from <a>
  • Removes @charset and @rev from <link>
  • Removes @abbr, @axis, @valid from <td> and <th>
  • Removes @scope from <td>
  • Removes @scheme from <meta>
  • Removes @longdesc from <img>

Notes

  • If you want to use this locally (file://) with Chrome/Chromium you need to start the browser with: --allow-file-access-from-files --allow-file-access Otherwise you'll get "Security error".
  • The tool has been tested with:
    • Firefox 3.6.21, 6.0.2, 7.0.1, 8.0.1
    • Chromium 14.0.835.186
    • Opera 11.50
    • Dreamweaver CS5

3rd Party

Using sax.js by Isaac Z. Schlueter as a JS SAX library: https://github.com/isaacs/sax-js
Using jszip by Stuart Knightley: http://jszip.stuartk.co.uk/

Flattr this project

Flattr this git repo

Something went wrong with that request. Please try again.