XHTML Interview Questions and Answers
Question - 11 : - Any other important new developments?
Answer - 11 : - 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 - 12 : - Why is this XSLT important?
Answer - 12 : - 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 - 13 : - What's XHTML Validation?
Answer - 13 : - 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:
simple document
a simple paragraph
Ampersands in hrefs must convert "&" to "&" in the URI
Sample List
becomes
Sample List
# 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
"
Question - 15 : - How to writing XHTML demands a clean HTML syntax?
Answer - 15 : - 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:
This is correct:
2. Attribute Values Must Be Quoted:
This is wrong:
This is correct:
3. Attribute Minimization Is Forbidden:
This is wrong:
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:
This is correct:
Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this:
Question - 16 : - XHTML should be the master storage format for my resources?
Answer - 16 : - 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 - 17 : - Can we get down to practicalities. How do I create XHTML pages?
Answer - 17 : - 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 - 18 : - What about conversion of existing HTML pages - especially bulk conversion, as I have many thousands of HTML files?
Answer - 18 : - 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 - 19 : - What's the advantages of XHTML?
Answer - 19 : - * 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.
Question - 20 : - What's XHTML DTD?
Answer - 20 : - The XHTML standard defines three Document Type Definitions.
The most common is the XHTML Transitional.
The Is Mandatory
An XHTML document consists of three main parts:
* the DOCTYPE
* the Head
* the Body
The basic document structure is:
...
...
The DOCTYPE declaration should always be the first line in an XHTML document.
An XHTML Example
This is a simple (minimal) XHTML document:
simple document
a simple paragraph
The DOCTYPE declaration defines the document type:
The rest of the document looks like HTML:
simple document
a simple paragraph
The 3 Document Type Definitions
* DTD specifies the syntax of a web page in SGML.
* DTD is used by SGML applications, such as HTML, to specify rules that apply to the markup of documents of a particular type, including a set of element and entity declarations.
* XHTML is specified in an SGML document type definition or 'DTD'.
* An XHTML DTD describes in precise, computer-readable language, the allowed syntax and grammar of XHTML markup.
There are currently 3 XHTML document types:
* STRICT
* TRANSITIONAL
* FRAMESET
XHTML 1.0 specifies three XML document types that correspond to three DTDs: Strict, Transitional, and Frameset.<
Share your email for latest updates
Copyright 2017, All Rights Reserved. A Product Design BY CoreNet Web Technology