Features:
'--- Converts HTML to ASP VBscript with Response.Write (selectable).
'--- Converts most of the HTML to XHTML 1.0 W3C compliant code. (Beta)
'--- Converts special characters and symbols (> }, &) to the corresponding HTML entities.
'--- Converts the & character to & HTML entity (selectable).
'--- Converts element and attribute names to lowercase (but not attribute values).
'--- Converts target attribute to javascript onclick and onkeypress events.
'--- Unquoted attribute values are enclosed in quotes. (selectable double """ or single ' enclosing quotes).
'--- Singleton tags like br, hr, img and input are automatically closed (... /> it does not automatically close other tags).
'--- Minimized attributes with no values get values (eg. selected to selected='selected', checked to checked='checked').
'--- The id attribute is added to form elements alongside name attribute (where not already present).
'--- The alt and title attributes are added to img elements (where not already present).
'--- Embedded server code (inside <% ..... %>), if any, is preserved during conversion.
'--- The Document Type Declaration (!DOCTYPE) is preserved character-for-character during conversion.
'--- Obsolete elements like Language='JavaScript' are removed.
'--- Selectable removal of empty lines.
'--- Selectable removal of Tabs (VbTab).
'--- Selectable add of a " & VbCrLf" to the end of HTML lines.
'--- The Tool is entirely coded with Classic ASP.
NOTE: to replace Response.Write with W the following code should be added to your ASP page:
Sub W(sText)
Response.Write sText & vbCrLf
End sub
Please report bugs, if any, thanks.
The basic rules that differentiate XHTML from HTML are as follow:
- XHTML documents must have the Document Type Declaration (!DOCTYPE) as first root element.
- XHTML documents must have the <html> root element.
- XHTML elements must be properly nested.
- All XHTML elements must be closed.
- All attributes must have a value.
- Attribute values must be (single or double) quoted.
- Tag and attribute names must be in lowercase.
- The id attribute must be together or replace the name attribute.
- Special characters and symbols must be encoded as HTML entities (included ampersand & as &).