Rewrite to XHTML (from HTML4.01 to XHTML1.0)

A mobile site becomes XHTML from CHTML, and a usual homepage has been shifting from HTML to XHTML gradually, too. Then, I also decisively rewrote the homepage from HTML4.01 to XHTML1.0.

Notes of difference and rewriting XHTML1.0 and HTML

It became a recommendation of W3C in 2000 XHTML (Extensible HyperText Markup Language) is taking of the extendibility of XML to HTML. Because XHTML applied XML, the format is severe though HTML was permitted though suitably writes the format to some degree.

The idea is originally advanced to HTML4.01 further in XHTML though externals are recommended to be set with CSS. In a word, sentences are expressed with HTML, and the externals are the methods of the description with external style sheet (CSS). Because I had been making the homepage since before by the method, the shift from this HTML4.01 to XHTML1.0 was comparatively easy.

Next, a Japanese code explains by rewriting from HTML4.01 to XHTML1.0 Transitional (XHTML is the one with a comparatively loose standard) as an example of the case of Shift JIS.

XML declaration and Japanese specification with XHTML

To show that it is a document written with XHTML, the XML declaration of XHTML and Japanese are specified at the head of the file as follows.

<?xml version="1.0" encoding="Shift_JIS"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="ja" lang="ja">
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
<meta http-equiv="Content-Style-Type" content="text/css" />

It is the above-mentioned description and there is no problem for usual XHTML and SSI, and it makes an error of the first line and it is not possible to display it for PHP. This <?It is because of becoming the error because of the same at the beginning as the part when the XML declaration that [de] starts omits and writes PHP. There is no problem if the following line is added to .htaccess file to use this omission with PHP.

php_flag short_open_tag Off

Or, the first line is made PHP command in PHP as follows.

<?php echo '<?xml version="1.0" encoding="Shift_JIS"?>'."\n"; ?>

It might make an error of the XML declaration made this first PHP command in the software such as the homepage builder, HTML Project2, and Expression Web3.

There seem to be pros and cons in XHTML document (text/html) for the web page though there is an opinion of omissible, too though this XML declaration is indispensable in general XHTML document (application/xhtml+xml).

Moreover, in the HTML tag as follows The xml:lang attribute is specified. Then, the lang attribute necessarily leaves the lang attribute by way of precaution because it might not recognize the xml:lang attribute by a browser though I do not want it.

xml:lang="ja" lang="ja"

All tag and attributes are described by the small letter.

You should write all tag, the element types, and attributes by the small letter in XHTML though you may write by the small letter even if tag is written by the capital letter in HTML. It is serious to rewrite HTML that has been written up to now.

However, the form The method attribute : It is likely to become trouble if it doesn't write with capital letters because the capital letter and the small letter are distinguished in HTTP. It should be a small letter, and it becomes a strange thing that it should be a capital letter in HTTP because it was united to the small letter in XHTML. It might be what how though wrote with capital letters only in this case.


The end tag cannot be omitted with XHTML

The end tag cannot be omitted with XHTML though there were some things that you may omit the end tag in HTML like the LI tag and P tag, etc.


The one without the end tag ends originally with />.

< br/> It describes it. The space of normal-width is opened in front of/> in consideration of interchangeability with an old browser that doesn't correspond to XHTML.

<br />
<hr />

To show the place in the file, the id attribute is described in parallel with the name attribute.

The attribute in which the place in the file was shown : in XHTML It became id attribute. Because there is a browser to which this id attribute is not supported either, the name attribute and the id attribute are adjusted to the same value and it describes it in parallel.

<a name="top" id="top">Jump to this page top</a>

All the attribute values are enclosed with ""

The attribute value is enclosed with ""This ..the description without enclosing it occasionally.." ..all without fail the attribute value.." in HTML.

<img src="**.jpg" alt="***" width="320" height="240" />

It writes without omitting the attribute name.

It describes it without neatly omitting it as follows though the attribute name was not occasionally described in HTML when the attribute name and the attribute value are the same in the FORM tag.

<option selected="selected">Other questions</option>

Full page rewriting and notes that use TEXTSS

When such all files are rewritten, TEXTSS of free software is very convenient. It is possible to rewrite it momentarily even when all files in the homepage are changed.

After the backup is taken, it changes.

It might be safer to preserve the backup file separately though the backup function is attached to TEXTSS. All file writing return operation from the BAK file is serious.

The backup is taken for a large amount of rewriting at each operation. It is possible to return it only to the stage to previous in one BAK file.

Rewriting of no substitution is done without fail before rewriting.

After the rewriting operation of no substitution is done to rewriting without fail even when absolutely confident and operation is confirmed, let's do a real rewriting operation. It is likely to fit in an unthinkable pitfall.

It keeps especially careful at the wild-card substitution.

Unexpected substitution is often generated though the wild-card substitution is very convenient. Executing it after it does away with the problem while confirming individual substitution even if it is troublesome is also important.

The method hits on only the use of the wild-card to add the end tag when there is no end tag like the IMG tag. I rewrote it while trying and erring with a wild-card this time.

Setting change of homepage builder

When becoming an error when the page of XHTML is made with the homepage builder, the homepage builder might rewrite the page without permission. In the setting of the homepage builder, the error should be set not to rewrite the page.

Because it is a standard and a capital letter, this is set to become a small letter about tag. Additionally, it changes to the setting that doesn't omit the end tag.