Skip to page content or Skip to Accesskey List.

Work

Main Page Content

Getting Xhtml From Homesite 4 5

Rated 3.92 (Ratings: 2)

Want more?

 

Bill Mason

Member info

User since: 10 Oct 2000

Articles written: 5

HomeSite, a robust text-based HTML editor for the Wintel world, can be prodded to produce XHTML with a little help. Here's a guide to doing it in the current 4.5 version:

First, go to the Options menu, choose Settings, and configure what you can in the program that will start you down the XHTML path:

  • Under "HTML", check off: Lowercase all inserted tags, Include closing </P> when inserting paragraph tag, and set the "Center" toolbutton to use <div align="center"></div>.
  • Under Editor/Tag Completion: turn this feature on and make sure all the proper HTML tags are in this list (the default that comes with the program does not include all tags).

Before we get to the fun part (editing the program's internal files), let's note that HomeSite 4.5 does include the HTML Tidy utility integrated into it, which can produce XHTML from HTML pretty readily. So if you don't want to mess further with the HomeSite program, HTML Tidy is a good way to go.

Now, to the good stuff: editing HomeSite's tag wizards to produce XHTML. Don't forget to back up these files before you edit them, because if you break them you'll probably have to reinstall the program to fix them.

The VTM files that make up the tag wizards are located in the /extensions/tagdefs/html directory. For each tag that needs to end with " />" (for example, <br />), open it's corresponding VTM file in HomeSite. Look for a line (usually towards the end of the file) that reads <WIZIF 1>></WIZIF> and change it to read <WIZIF 1> /></WIZIF>.

This works for all tags needing the closing slash except for img, which doesn't have a VTM file. You'll have to either take care of img tags manually, or use an alternate VTM file/wizard for your img tags. I use one by Marjolein Katsma, who originally wrote much of the VTML wizards for HomeSite. You can get a copy of it (called TagEditor_Toolbar_HS45.zip) from her web site if you're interested.

Next, we need to edit VTM files for tags such as td, where attributes like nowrap have to be rendered as nowrap="nowrap". Open the VTM file for the tag, and look for a line such as this one in the td file:

<WIZIF checkNOWRAP EQ 'true'>$$SpacingGap$${DefaultCase('NOWRAP')}<WIZSET SpacingGap = VertSpacingGap></WIZIF>

This line is basically outputting nowrap into the tag if the NOWRAP checkbox was checked off. So we just change the output:

<WIZIF checkNOWRAP EQ 'true'>$$SpacingGap$${DefaultCase('NOWRAP=nowrap')}<WIZSET SpacingGap = VertSpacingGap></WIZIF>

At this point, you have all the tag wizards (img aside) producing XHTML. Now, we edit the built-in validator so that it knows all this XHTML is valid:

  • Follow the program menus to Options > Settings > Validation > Validator Settings > Tags > HTML
  • For any tag that needs a closing " />", go to it's Attributes folder. Add an attribute "/" to it, and make the attribute's value equal "no value".
  • For tags with attributes that can no longer be minimized (e.g. td nowrap="nowrap"):
    1. Go to the Values tab and add the value to the list (e.g. nowrap).
    2. Go back to the Tags tab, go to the tag in question (e.g. td), and add the attribute (e.g. nowrap) to the list. Assign the value (e.g. nowrap) to the attribute.

With that, you should have HomeSite producing XHTML, and its built-in validator will recognize it as valid!

Front-end web development (mostly) and an interest/focus in web accessibility. I also recently co-authored my first book, The Web Professional's Handbook, published by the late great glasshaus.

I've been out of work since October 2001. Be kind and glance over my portfolio....

The access keys for this page are: ALT (Control on a Mac) plus:

evolt.org Evolt.org is an all-volunteer resource for web developers made up of a discussion list, a browser archive, and member-submitted articles. This article is the property of its author, please do not redistribute or use elsewhere without checking with the author.