Answers to often asked questions on XHTML and HTML
What for it is necessary XHTML? Whether it is enough HTML?
HTML - it is possible, the markup language of documents most popular in the world. With occurrence XML discussion has been organized, whether new version HTML in frameworks XML is necessary. Participants have answered unequivocally "yes": version HTML based on XML, will allow to use elements XHTML in other languages XML, and documents XHTML can use elements of other languages XML. Besides possible{probable} will put in order HTML, having liquidated his{its} most "slovenly" elements and having expanded his{its} functionality, for example, the improved realization of forms.
In what of advantage XHTML before HTML?
If the document makes idle time XHTML 1.0 (without use of other languages of a marking) you will not notice an essential difference. However in due course accessible become more and more and more tools, based on XML (such as XSLT for transformation of documents) and you sooner or later will notice advantages of use XHTML. For example, technology XForms will allow you to edit documents XHTML (and any other documents XML). Applications of the Semantic Network (Semantic Web) will be capable to use advantages XHTML.
If the document contains something the greater, than XHTML 1.0, for example, inclusions of languages MathML, SMIL, SVG advantages it is available: you could not use these technologies with HTML.
Whether it is possible to add simply announcement XML in the beginning of existing document HTML? Whether it is possible to mix code HTML 4.01 and XHTML?
No. Format HTML is not based on XML. To interpret the data as XML, you should make necessary changes to make a code of the document correct code XML.
How it is the easiest to transform documents HTML in XHTML?
Program HTML Tidy allows to receive XHTML from code HTML. A browser and web - editor Amaya saves HTML documents in format XHTML.
Why developers of browsers so suetjatsja with XML? Whether better for browsers to work with HTML?
XML enters more strict rules of processing of documents. Browsers HTML work with any entrance data, korektnymi and nekorektnymi, and try to interpret them. The circuit of processing of mistakes very much complicates development of programs, is especial if to take into account, that is supposed, that reaction of all browsers on nekorektnye the data should be identical. Besides it means, that the huge number of documents HTML is contained with mistakes, but are normally displayed by browsers, and authors do not suspect that code HTML is incorrect. That is why it is extraordinary difficult to create the new user agent, while the documents which are given out for HTML, often very much plokhi.
What for to me to worry about fidelity of code HTML? In my browser the document is displayed correctly.
All browsers are capable to process correct code HTML. But if the code is incorrect, the browser makes corrections; as different browsers differently process mistakes, it results to that the document differently looks in different browsers. Browsers exists hundreds, their number constantly grows (not only for the PC, but also for a handheld computer, mobile phones, TVs, printers and even refrigerators) to test the document on all browsers it is impossible. If your document contains mistakes and is incorrectly displayed in a concrete browser, it is your fault but if code HTML is correct incorrect display already on conscience of developers of the program.
How it is possible to check up a correctness of a marking in my document?
W3C Gives for this purpose validator: http://validator.w3.org/. Browser Amaya informs, whether the code of displayed documents is correct.
Why you not always use the term « the user agent » (« user agent ») instead of "browser"?
While browsers are important users HTML and XHTML, there are many other programs and systems which use (X) HTML documents. Search machines, for example, read out documents though do not concern to browsers. Using the term « the user agent », we try to emphasize a difference.
For example, having queried poiskoviku Google, as a result of search together with the link it is possible to see the text « web - page uses frames, but your browser does not support them »; some people ignore such links. Founders of such sites do not imagine, that the content is required not to only one browsers, and that the element <noframes> should contain more provident text which is not appearing so silly in opinion of people, using search.
For what it is necessary to use nominal spaces (namespace) in XHTML?
In days of becoming HTML various groups and the companies added at the desire new elements and attributes in HTML. It threatened with mess with versions HTML which is not being standard. XML ("X" means "expanded", "Extensible") allows all to use elements from various languages, but a browser or other user agent should define{determine} somehow, this or that element concerns to what language. For this purpose announcements of nominal spaces (namespace) also are required.
Why documents XHTML 1.0 should not be sent as text/html?
XHTML has format XML; it means, that the type of the data of document XHTML should correspond with XML (application/xhtml+xml, application/xml, or text/xml). However XHTML 1.0 it was created so that documents could be displayed by user agents HTML correctly. If you will follow to several simple rules, documents XHTML 1.0 will approach{suit} for browsers HTML. But as the last work only with type of the data text/html, it is necessary for you to pass XHTML 1.0 as text/html to provide compatibility with the out-of-date software. But know: the document with zagolovokom text/html will be always processed as idle time HTML, instead of XHTML.
What browsers accept type of the data application/xhtml+xml?
Browsers known to us - all based on Mozilla (Mozilla, Netscape 5 +, Galeon, Firefox), Opera, Amaya, Camino, Chimera, DocZilla, iCab, Safari, plus the software for the mobile phones working with WAP2. Actually, any modern browser should accept type of the data application/xml. Address to the test for type of data XHTML for details.
Whether accepts Microsoft Internet Explorer type application/xhtml+xml?
No, but there is a dodge which will allow to pass XHTML1.0 for Internet Explorer in quality application/xml.
Add in the beginning of the document the line selected below:
<? xml version = " 1.0" encoding = "iso-8859-1"?>
<? xml-stylesheet type = "text/xsl" href = "copy.xsl"?>
<! DOCTYPE html PUBLIC " - // W3C // DTD XHTML 1.0 Transitional // EN "
" http: // www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns = " http: // www.w3.org/1999/xhtml ">
<head>
The file copy.xsl should contain such code:
<stylesheet version = " 1.0"
xmlns = " http: // www.w3.org/1999/XSL/Transform ">
<template match = "/">
<copy-of select = "."/>
</template>
</stylesheet>
The file should contain on the same site from which the document is passed.
You pass the document as XML, he passes processing, in a result the browser considers, that is received text/html; thus, using the resulted advice{council}, you should take into account all rules which are required for maintenance of compatibility XHTML 1.0 with browsers HTML.
The document will work for browsers which accept XHTML 1.0 as application/xml.
In CSS there are rules which concern only to HTML. whether these rules to XHTML are applied?
No. Rules CSS concerning only to HTML, are applied only to the documents transferred{handed} as text/html.
Whether works document.write in XHTML?
No. Essence XML assumes, that it is impossible to generate a marking scripts while parser still processes a marking.
It is possible to achieve the same effect, as document.write, but for addition and removal{distance} of elements it is necessary to use DOM.
Why it is impossible to pass dokumety XHTML 1.1 in quality text/html?
XHTML 1.1 represents usual XML, prednaznachenyj only for processing in quality XML. XHTML 1.1 it is impossible to pass browsers HTML. Therefore documents XHTML 1.1 necessarily should be passed with the type of the data concerning to XML, such as application/xhtml+xml.
Why from XHTML 1.1 the attribute target has been liquidated?
The attribute target was not liquidated from XHTML 1.1. XHTML 1.0 subdivided into three different versions: strict, transitional and frameset. All versions provide such compatibility with HTML 4.01 which only allows XML. XHTML 1.1 - updated version XHTML 1.0 strict, and the attribute target was not in one version HTML strict. Other versions, transitional and frameset, have not been updated, as in it there is no necessity. If you want to use attribute target, use XHTML 1.0 transitional.
For what it is used moduljarizacija XHTML?
Moduljarizacija XHTML (Modularization) it is intended for application by developers of the languages based on XHTML, but not users of languages. The companies and groups often develop own versions HTML and XHTML which are not compatible among themselves. Moduljarizacija divides{shares} XHTML on modules which can be used separately at definition of a modern language; so, for example, any version of language using the tables, will work with uniform for XHTML definition of tables. Besides moduljarizacija explains, in what cases it is possible to add new elements and in what - no.
What for it is necessary XHTML2? Whether it is enough XHTML 1?
HTML and XHTML the problems{tasks} assigned to them have carried out, but in these languages there is a set of elements which need to be improved. In XHTML2 the special attention is given to improvement of opportunities of structurization, removal{distance} of elements which already are in XML, to convenience of use (usability), availability (accessibility), internationalizations, to the hardware independence, the improved mechanism of forms, elimination of necessity for use skriptovanija.
Whether in XHTML2 the element will be replaced with an element?
No. The element <img> will be replaced in XHTML2, but something with another (though you can use and <object> if want).
The design <img> in HTML has many lacks:
* He does not give an opportunity of the maintenance{contents} of alternative images so, for example, image PNG can be replaced only with the text of attribute alt if the browser does not perceive format PNG. It just also has prevented distribution of format PNG (the best, than GIF and JPG), as authors of a content used older formats to be confident, that the schedule is accessible to all users.
* The text of attribute alt cannot be marked, so if you use alt the plain text is accessible to you only.
* For blind users it is possible to use the link longdesc on the description of the image, but this opportunity is seldom realized.
In XHTML2 images are equated to components of a content, it is carried out by giving vojstva src to any element. If the image is accessible also a browser can process it{him}, the schedule will be used, differently the browser will use contents of an element. For example:
<p src = "map.png"> the Output{Exit} from station, turn on the left,
Rise on steps on <strong> the Top Street </strong>
Also turn to the right </p>
Advantage of it that in case the image is inaccessible (for example, because of mistakes in a network) or cannot be processed by a browser, the document remains accessible. If it is required to use more than one image, the code will look so:
<p src = "map.png"> <span src = "map.gif"> the Output{Exit} from station... </span> </p>
Certainly, it is better to use technology content negotiation if she{it} is supported with your server:
<p src = "map"> the Output{Exit} from station... </p>
In that case, the server "agrees" with a browser, what format schedules to pass the program. If accessible images no, contents of an element will be used. It allows to add images of a separate format later, not changing a code of pages.
Why XHTML2 does not use XLink?
XLink and XHTML have various requirements for use of links, and these requirements are not compatible.
Why in XHTML2 there is no compatibility with old versions XHTML?
Compatibility is, but she is realized differently, than before.
Early versions HTML were languages for a concrete scope (not sootnosjahhimisja with any general{common} tool of a marking), therefore it was important to support compatibility so that old browsers correctly perceived documents. For example, for this reason the element <meta> contains the data in the attribute, instead of as the contents - so compatibility with the former software is provided.
However thanking XML and to tables of styles, such strict mechanism of compatibility is not necessary any more as browser XML (at the moment of a spelling of this text of 95 % of browsers accept XML) can process a modern language without updating. Many opportunities XHTML 2 are already accessible in the modern browsers which were not created specially for XHTML2. Much works, but not all: when forms and tables have been added in HTML, people had to wait for occurrences of new browsers; the same way special elements XHTML 2, such as XForms and XML Events, demand from the software of understanding of their functionality.
Why xml:space it is established as 'preserve' for all elements XHTML2? I do not want to see additional blanks in a conclusion of a browser.
The attribute xml:space is connected to input: he is required to supervise, whether blanks will be submitted in DOM (i.e. in the internal version of the document from which the browser works); it does not concern to final display of documents. The conclusion probel`nykh symbols is established svojtvom CSS 'whitespace'. Appropriate{give} to him value 'pre' that all probel`nye symbols DOM were visible at a conclusion; value 'normal' will hide probel`nye symbols (CSS3 will contain richer means of the control of a conclusion).
For this reason for all elements XHTML it is established xml:space = "preserve": otherwise property 'whitespace' would not have dejsivija. The table of styles by default establishes 'whitespace' value 'normal' for all elements, except for <pre>, but you can change it in the tables.

|