Set - 2

Question 1 :

Any other important new developments?

Answer :

Yes: XSLT provides a transformation language which can be used to transform XML documents into other formats. XSLT can be used to transform documents from one XML DTD to another, or even to transform an XML document to an alternative format such as RTF or PDF.


Question 2 :

Why is this XSLT important?

Answer :

You've heard all the hype about mobile phones and WAP haven't you? How do you think the WAP world, which expects documents to be in WML format, to be populated? Rather than manually creating WML markup, XSLT will enable XHTML documents to be automatically converted to WML.


Question 3 :

What's XHTML Validation?

Answer :

An XHTML document is validated against a Document Type Definition.
Validate XHTML With A DTD

An XHTML document is validated against a Document Type Definition (DTD). Before an XHTML file can be properly validated, a correct DTD must be added as the first line of the file.

The Strict DTD includes elements and attributes that have not been deprecated or do not appear in framesets:

!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"

The Transitional DTD includes everything in the strict DTD plus deprecated elements and attributes:

!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

The Frameset DTD includes everything in the transitional DTD plus frames as well:

!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"

This is a simple XHTML document:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>simple document</title>
</head>
<body>
<p>a simple paragraph</p>
</body>
</html>

 


Question 4 :

Ampersands in hrefs must convert "&" to "&amp;" in the URI ?

Answer :

<a href="http://www.phonelists.com/cgi-bin/Handler.pl?ListID=Test&Password=test&action=View">Sample List</a>
becomes 
<a href="http://www.phonelists.com/cgi-bin/Handler.pl?ListID=Test&Password=test&action=View">Sample List</a>

# The attribute "name" becomes "id" when used for a locator inside a document

For example, to reference a section within a document with a URI, we usually do something like

<a href="favoriteAnimals.html#meerkats">Meerkats</a>

Inside the referenced section,

<a name="meerkats"><h2>Meerkats of Africa</h2></a>

becomes

<a id="meerkats"><h2>Meerkats of Africa</h2></a>

or better yet for backwards compatibility:

<a id="meerkats" name="meerkats"><h2>Meerkats of Africa</h2></a>

# Tidy
tidy is a tool to automatically convert HTML to XHTML. You can find it at http://www.w3.org/People/Raggett/tidy/.


Question 5 :

What's about an assumption with XHTML? 

Answer :

Serving XHTML with a MIME type of text/html is wrong. The whole point of XHTML is that it's XML so that you can benefit from namespaces and the like. If you serve it as text/html, you can't: 
In particular, 'text/html' is NOT suitable for XHTML Family document types that adds elements and attributes from foreign namespaces, such as XHTML+MathML [XHTML+MathML].
Source: http://www.w3.org/TR/xhtml-media-types/#text-html
Two choices:
1. XHTML 1.0 served as application/xhtml+xml to conforming UAs, and text/html to Internet Explorer
2. HTML 4.01, served as text/html 
XHTML 1.1 is not an option because it mandates a MIME type of application/xhtml+xml which is incompatible with Internet Explorer


Question 6 :

How to writing XHTML demands a clean HTML syntax? 

Answer :

Some More XHTML Syntax Rules:
* Attribute names must be in lower case
* Attribute values must be quoted
* Attribute minimization is forbidden
* The id attribute replaces the name attribute
* The XHTML DTD defines mandatory elements

1. Attribute Names Must Be In Lower Case:
This is wrong:
<table WIDTH="100%">
This is correct:
<table width="100%">

2. Attribute Values Must Be Quoted:
This is wrong:
<table width=100%> 
This is correct:
<table width="100%"> 

3. Attribute Minimization Is Forbidden: 
This is wrong:
<input checked>
<input readonly>
<input disabled>
<option selected>
<frame noresize>

This is correct:
<input checked="checked" />
<input readonly="readonly" />
<input disabled="disabled" />
<option selected="selected" />
<frame noresize="noresize" />

Here is a list of the minimized attributes in HTML and how they should be written in XHTML:
HTML XHTML 
compact compact="compact"
checked checked="checked"
declare declare="declare"
readonly readonly="readonly"
disabled disabled="disabled"
selected selected="selected"
defer defer="defer"
ismap ismap="ismap"
nohref nohref="nohref"
noshade noshade="noshade"
nowrap nowrap="nowrap"
multiple multiple="multiple"
noresize noresize="noresize"

4. The id Attribute Replaces The name Attribute: HTML 4.01 defines a name attribute for the elements a, applet, frame, iframe, img, and map. In XHTML the name attribute is deprecated. Use id instead.

This is wrong:
<img src="picture.gif" name="picture1" />
This is correct:
<img src="picture.gif" id="picture1" />

Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this: 
<img src="picture.gif" id="picture1" name="picture1" /> 
IMPORTANT Compatibility Note:
To make your XHTML compatible with today's browsers, you should add an extra space before the "/" symbol. The Lang Attribute
The lang attribute applies to almost every XHTML element. It specifies the language of the content within an element.
If you use the lang attribute in an element, you must add the xml:lang attribute, like this: 
<div lang="no" xml:lang="no">Heia Norge!</div>

Mandatory XHTML Elements
All XHTML documents must have a DOCTYPE declaration. The html, head and body elements must be present, and the title must be present inside the head element.

This is a minimum XHTML document template:

<!DOCTYPE Doctype goes here>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title goes here</title>
</head>

<body>
Body text goes here
</body>
</html>

Note: The DOCTYPE declaration is not a part of the XHTML document itself. It is not an XHTML element, and it should not have a closing tag. 
Note: The xmlns attribute inside the <html> tag is required in XHTML. However, the validator on w3.org does not complain when this attribute is missing in an XHTML document. This is because "xmlns=http://www.w3.org/1999/xhtml" is a fixed value and will be added to the <html> tag even if you do not include it.


Question 7 :

XHTML should be the master storage format for my resources?

Answer :

NO! XHTML still lacks semantics. Ideally your resources should be stored in an appropriate XML format. XSLT can then be used to convert the resources to XHTML (for Web browsers), WML (for mobile phones), etc. XHTML is a useful intermediate stage.


Question 8 :

Can we get down to practicalities. How do I create XHTML pages?

Answer :

The eGroups XHTML-L Web site provides links to XHTML tools, including conversion tools and editors. A couple of free tools are available (HTML-Kit, 1st Page 2000). Mozquito Factory appears to be the first licensed package on the market.
You can expect the usual suspects (Microsoft, Dreamweaver, etc) to bring out new versions of their products with XHTML support.


Question 9 :

What about conversion of existing HTML pages - especially bulk conversion, as I have many thousands of HTML files?

Answer :

W3C has written a utility program called Tidy which can be used to convert HTML pages to XHTML. Tidy can be used in batch mode to bulk-convert documents. Tidy is an open source program, which has been incorporated into an number of authoring tools, most notably HTML-Kit


Question 10 :

What's the advantages of XHTML?

Answer :

* Mixed namespaces
* Much simpler to work with (for programs, at least) than HTML
* You will immediately know when your document is not well-formed due to an error from your UA.