1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "dtds/xhtml1-strict.dtd"> 2 <?xml-stylesheet href="W3C-PR.css" type="text/css"?> 3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> 4 <head> 5 <title>XHTML 1.0: The Extensible HyperText Markup 6 Language</title> 7 <link rel="stylesheet" 8 href="W3C-PR.css" type="text/css" /> 9 <style type="text/css"> 10 span.term { font-style: italic; color: rgb(0, 0, 192) } 11 code { 12 color: green; 13 font-family: monospace; 14 font-weight: bold; 15 } 16 17 code.greenmono { 18 color: green; 19 font-family: monospace; 20 font-weight: bold; 21 } 22 .good { 23 border: solid green; 24 border-width: 2px; 25 color: green; 26 font-weight: bold; 27 margin-right: 5%; 28 margin-left: 0; 29 } 30 .bad { 31 border: solid red; 32 border-width: 2px; 33 margin-left: 0; 34 margin-right: 5%; 35 color: rgb(192, 101, 101); 36 } 37 38 img { 39 color: white; 40 border: none; 41 } 42 43 div.navbar { text-align: center; } 44 div.contents { 45 background-color: rgb(204,204,255); 46 padding: 0.5em; 47 border: none; 48 margin-right: 5%; 49 } 50 .tocline { list-style: none; } 51 table.exceptions { background-color: rgb(255,255,153); } 52 </style> 53 </head> 54 <body> 55 <div class="navbar"> 56 <a href="#toc">table of contents</a> 57 <hr /> 58 </div> 59 <div class="head"><p><a href="http://www.w3.org/"><img class="head" 60 src="w3c_home.gif" alt="W3C" /></a></p> 61 62 <h1 class="head"><a name="title" id="title">XHTML</a><sup>™</sup> 1.0: 63 The Extensible HyperText Markup Language</h1> 64 65 <h2>A Reformulation of HTML 4.0 in XML 1.0</h2> 66 67 <h3>W3C Proposed Recommendation 10 December 1999</h3> 68 69 <dl> 70 <dt>This version:</dt> 71 72 <dd><a href= 73 "http://www.w3.org/TR/1999/PR-xhtml1-19991210"> 74 http://www.w3.org/TR/1999/PR-xhtml1-19991210</a> <br /> 75 (<a href="xhtml1.ps">Postscript version</a>, 76 <a href="xhtml1.pdf">PDF version</a>, 77 <a href="xhtml1.zip">ZIP archive</a>, or 78 <a href="xhtml1.tgz">Gzip'd TAR archive</a>) 79 </dd> 80 81 <dt>Latest version:</dt> 82 83 <dd><a href="http://www.w3.org/TR/xhtml1"> 84 http://www.w3.org/TR/xhtml1</a></dd> 85 86 <dt>Previous versions:</dt> 87 88 <dd><a href= 89 "http://www.w3.org/TR/1999/WD-xhtml1-19991124"> 90 http://www.w3.org/TR/1999/WD-xhtml1-19991124</a></dd> 91 <dd><a href= 92 "http://www.w3.org/TR/1999/PR-xhtml1-19990824"> 93 http://www.w3.org/TR/1999/PR-xhtml1-19990824</a></dd> 94 95 <dt>Authors:</dt> 96 97 <dd>See <a href="#acks">acknowledgements</a>.</dd> 98 </dl> 99 100 <p class="copyright"><a href= 101 "http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"> 102 Copyright</a> © 1999 <a href="http://www.w3.org/">W3C</a><sup>®</sup> 103 (<a href="http://www.lcs.mit.edu/">MIT</a>, <a href= 104 "http://www.inria.fr/">INRIA</a>, <a href= 105 "http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. <abbr 106 title="World Wide Web Consortium">W3C</abbr> <a 107 href= 108 "http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer"> 109 liability</a>, <a href= 110 "http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks"> 111 trademark</a>, <a href= 112 "http://www.w3.org/Consortium/Legal/copyright-documents">document 113 use</a> and <a href= 114 "http://www.w3.org/Consortium/Legal/copyright-software">software 115 licensing</a> rules apply.</p> 116 <hr /> 117 </div> 118 119 <h2 class="notoc">Abstract</h2> 120 121 <p>This specification defines <abbr title="Extensible Hypertext Markup 122 Language">XHTML</abbr> 1.0, a reformulation of HTML 123 4.0 as an XML 1.0 application, and three <abbr title="Document Type 124 Definition">DTDs</abbr> corresponding to 125 the ones defined by HTML 4.0. The semantics of the elements and 126 their attributes are defined in the W3C Recommendation for HTML 127 4.0. These semantics provide the foundation for future 128 extensibility of XHTML. Compatibility with existing HTML user 129 agents is possible by following a small set of guidelines.</p> 130 131 <h2>Status of this document</h2> 132 133 <p><em>This section describes the status of this document at the time 134 of its publication. Other documents may supersede this document. The 135 latest status of this document series is maintained at the W3C.</em></p> 136 137 <p>This specification is a Proposed Recommendation of the HTML Working Group. It is 138 a revision of the Proposed Recommendation dated <a 139 href= "http://www.w3.org/TR/1999/PR-xhtml1-19990824/">24 August 140 1999</a> incorporating changes as a result of comments from the Proposed 141 Recommendation review, and 142 comments and further deliberations of the W3C HTML Working Group. A 143 <a href="xhtml1-diff-19991210.html">diff-marked version</a> from the previous 144 proposed recommendation is available for comparison purposes.</p> 145 146 <p>On 10 December 1999, this document enters a 147 <a href="http://www.w3.org/Consortium/Process/#RecsPR"> 148 Proposed Recommendation</a> review period. From that date until 8 January 149 2000, 150 W3C Advisory Committee representatives are encouraged 151 to review this specification and return comments in their completed 152 ballots to w3c-html-review (a] w3.org. Please send any comments of a 153 confidential nature in separate email to w3t-html (a] w3.org, which is 154 visible to the Team only.</p> 155 156 <p>No sooner than 14 days after the end of the review period, the 157 Director will announce the document's disposition: it may become a W3C 158 Recommendation (possibly with minor changes), it may revert to Working 159 Draft status, or it may be dropped as a W3C work item.</p> 160 161 <p>Publication as a Proposed Recommendation does not imply endorsement 162 by the W3C membership. This is still a draft document and may be 163 updated, replaced or obsoleted by other documents at any time. It is 164 inappropriate to cite W3C Proposed Recommendation as other than "work 165 in progress."</p> 166 167 <p>This document has been produced as part of the <a href= 168 "http://www.w3.org/MarkUp/">W3C HTML Activity</a>. The goals of 169 the <a href="http://www.w3.org/MarkUp/Group/">HTML Working 170 Group</a> <i>(<a href="http://cgi.w3.org/MemberAccess/">members 171 only</a>)</i> are discussed in the <a href= 172 "http://www.w3.org/MarkUp/Group/HTMLcharter">HTML Working Group 173 charter</a> <i>(<a href="http://cgi.w3.org/MemberAccess/">members 174 only</a>)</i>.</p> 175 176 <p>A list of current W3C Recommendations and other technical documents 177 can be found at <a 178 href="http://www.w3.org/TR">http://www.w3.org/TR</a>.</p> 179 180 <p>Public discussion on <abbr title="HyperText Markup 181 Language">HTML</abbr> features takes place on the mailing list <a 182 href="mailto:www-html (a] w3.org"> www-html (a] w3.org</a> (<a href= 183 "http://lists.w3.org/Archives/Public/www-html/">archive</a>). The W3C 184 staff contact for work on HTML is <a href= "mailto:dsr (a] w3.org">Dave 185 Raggett</a>.</p> 186 187 <p>Please report errors in this document to <a 188 href="mailto:www-html-editor (a] w3.org">www-html-editor (a] w3.org</a>.</p> 189 190 <p>The list of known errors in this specification is available at <a 191 href="http://www.w3.org/1999/12/PR-xhtml1-19991210-errata">http://www.w3.org/1999/12/PR-xhtml1-19991210-errata</a>.</p> 192 193 <h2 class="notoc"><a id="toc" name="toc">Contents</a></h2> 194 195 <div class="contents"> 196 <ul class="toc"> 197 <li class="tocline">1. <a href="#xhtml">What is XHTML?</a> 198 199 <ul class="toc"> 200 <li class="tocline">1.1 <a href="#html4">What is HTML 4.0?</a></li> 201 202 <li class="tocline">1.2 <a href="#xml">What is XML?</a></li> 203 204 <li class="tocline">1.3 <a href="#why">Why the need for XHTML?</a></li> 205 </ul> 206 </li> 207 208 <li class="tocline">2. <a href="#defs">Definitions</a> 209 210 <ul class="toc"> 211 <li class="tocline">2.1 <a href="#terms">Terminology</a></li> 212 213 <li class="tocline">2.2 <a href="#general">General Terms</a></li> 214 </ul> 215 </li> 216 217 <li class="tocline">3. <a href="#normative">Normative Definition of XHTML 1.0</a> 218 219 220 <ul class="toc"> 221 <li class="tocline">3.1 <a href="#docconf">Document Conformance</a></li> 222 223 <li class="tocline">3.2 <a href="#uaconf">User Agent Conformance</a></li> 224 </ul> 225 </li> 226 227 <li class="tocline">4. <a href="#diffs">Differences with HTML 4.0</a> 228 229 </li> 230 231 <li class="tocline">5. <a href="#issues">Compatibility Issues</a> 232 233 <ul class="toc"> 234 <li class="tocline">5.1 <a href="#media">Internet Media Types</a></li> 235 </ul> 236 </li> 237 238 <li class="tocline">6. <a href="#future">Future Directions</a> 239 240 <ul class="toc"> 241 <li class="tocline">6.1 <a href="#mods">Modularizing HTML</a></li> 242 243 <li class="tocline">6.2 <a href="#extensions">Subsets and Extensibility</a></li> 244 245 <li class="tocline">6.3 <a href="#profiles">Document Profiles</a></li> 246 </ul> 247 </li> 248 249 <li class="tocline"><a href="#dtds">Appendix A. DTDs</a></li> 250 251 <li class="tocline"><a href="#prohibitions">Appendix B. Element 252 Prohibitions</a></li> 253 254 <li class="tocline"><a href="#guidelines">Appendix C. HTML Compatibility Guidelines</a></li> 255 256 <li class="tocline"><a href="#acks">Appendix D. Acknowledgements</a></li> 257 258 <li class="tocline"><a href="#refs">Appendix E. References</a></li> 259 </ul> 260 </div> 261 262 <!--OddPage--> 263 <h1><a name="xhtml" id="xhtml">1. What is XHTML?</a></h1> 264 265 <p>XHTML is a family of current and future document types and modules that 266 reproduce, subset, and extend HTML 4.0 <a href="#ref-html4">[HTML]</a>. XHTML family document types are <abbr title="Extensible Markup Language">XML</abbr> based, 267 and ultimately are designed to work in conjunction with XML-based user agents. 268 The details of this family and its evolution are 269 discussed in more detail in the section on <a href="#future">Future 270 Directions</a>. </p> 271 272 <p>XHTML 1.0 (this specification) is the first document type in the XHTML 273 family. It is a reformulation of the three HTML 4.0 document types as 274 applications of XML 1.0 <a href="#ref-xml"> [XML]</a>. It is intended 275 to be used as a language for content that is both XML-conforming and, if some 276 simple <a href="#guidelines">guidelines</a> are followed, 277 operates in HTML 4.0 conforming user agents. Developers who migrate 278 their content to XHTML 1.0 will realize the following benefits:</p> 279 280 <ul> 281 <li>XHTML documents are XML conforming. As such, they are readily viewed, 282 edited, and validated with standard XML tools.</li> 283 <li>XHTML documents can be written to 284 to operate as well or better than they did before in existing 285 HTML 4.0-conforming user agents as well as in new, XHTML 1.0 conforming user 286 agents.</li> 287 <li>XHTML documents can utilize applications (e.g. scripts and applets) that rely 288 upon either the HTML Document Object Model or the XML Document Object Model <a 289 href="#ref-dom">[DOM]</a>.</li> 290 <li>As the XHTML family evolves, documents conforming to XHTML 1.0 will be more 291 likely to interoperate within and among various XHTML environments.</li> 292 </ul> 293 294 <p>The XHTML family is the next step in the evolution of the Internet. By 295 migrating to XHTML today, content developers can enter the XML world with all 296 of its attendant benefits, while still remaining confident in their 297 content's backward and future compatibility.</p> 298 299 <h2><a name="html4" id="html4">1.1 What is HTML 4.0?</a></h2> 300 301 <p>HTML 4.0 <a href="#ref-html4">[HTML]</a> is an <abbr title="Standard 302 Generalized Markup Language">SGML</abbr> (Standard 303 Generalized Markup Language) application conforming to 304 International Standard <abbr title="Organization for International 305 Standardization">ISO</abbr> 8879, and is widely regarded as the 306 standard publishing language of the World Wide Web.</p> 307 308 <p>SGML is a language for describing markup languages, 309 particularly those used in electronic document exchange, document 310 management, and document publishing. HTML is an example of a 311 language defined in SGML.</p> 312 313 <p>SGML has been around since the middle 1980's and has remained 314 quite stable. Much of this stability stems from the fact that the 315 language is both feature-rich and flexible. This flexibility, 316 however, comes at a price, and that price is a level of 317 complexity that has inhibited its adoption in a diversity of 318 environments, including the World Wide Web.</p> 319 320 <p>HTML, as originally conceived, was to be a language for the 321 exchange of scientific and other technical documents, suitable 322 for use by non-document specialists. HTML addressed the problem 323 of SGML complexity by specifying a small set of structural and 324 semantic tags suitable for authoring relatively simple documents. 325 In addition to simplifying the document structure, HTML added 326 support for hypertext. Multimedia capabilities were added 327 later.</p> 328 329 <p>In a remarkably short space of time, HTML became wildly 330 popular and rapidly outgrew its original purpose. Since HTML's 331 inception, there has been rapid invention of new elements for use 332 within HTML (as a standard) and for adapting HTML to vertical, 333 highly specialized, markets. This plethora of new elements has 334 led to compatibility problems for documents across different 335 platforms.</p> 336 337 <p>As the heterogeneity of both software and platforms rapidly 338 proliferate, it is clear that the suitability of 'classic' HTML 339 4.0 for use on these platforms is somewhat limited.</p> 340 341 <h2><a name="xml" id="xml">1.2 What is XML?</a></h2> 342 343 <p>XML<sup>™</sup> is the shorthand for Extensible Markup 344 Language, and is an acronym of Extensible Markup Language <a 345 href="#ref-xml">[XML]</a>.</p> 346 347 <p>XML was conceived as a means of regaining the power and 348 flexibility of SGML without most of its complexity. Although a 349 restricted form of SGML, XML nonetheless preserves most of SGML's 350 power and richness, and yet still retains all of SGML's commonly 351 used features.</p> 352 353 <p>While retaining these beneficial features, XML removes many of 354 the more complex features of SGML that make the authoring and 355 design of suitable software both difficult and costly.</p> 356 357 <h2><a name="why" id="why">1.3 Why the need for XHTML?</a></h2> 358 359 <p>The benefits of migrating to XHTML 1.0 are described above. Some of the 360 benefits of migrating to XHTML in general are:</p> 361 362 <ul> 363 <li>Document developers and user agent designers are constantly 364 discovering new ways to express their ideas through new markup. In XML, it is 365 relatively easy to introduce new elements or additional element 366 attributes. The XHTML family is designed to accommodate these extensions 367 through XHTML modules and techniques for developing new XHTML-conforming 368 modules (described in the forthcoming XHTML Modularization specification). 369 These modules will permit the combination of existing and 370 new feature sets when developing content and when designing new user 371 agents.</li> 372 373 <li>Alternate ways of accessing the Internet are constantly being 374 introduced. Some estimates indicate that by the year 2002, 75% of 375 Internet document viewing will be carried out on these alternate 376 platforms. The XHTML family is designed with general user agent 377 interoperability in mind. Through a new user agent and document profiling 378 mechanism, servers, proxies, and user agents will be able to perform 379 best effort content transformation. Ultimately, it will be possible to 380 develop XHTML-conforming content that is usable by any XHTML-conforming 381 user agent.</li> 382 383 </ul> 384 <!--OddPage--> 385 <h1><a name="defs" id="defs">2. Definitions</a></h1> 386 387 <h2><a name="terms" id="terms">2.1 Terminology</a></h2> 388 389 <p>The following terms are used in this specification. These 390 terms extend the definitions in <a href="#ref-rfc2119"> 391 [RFC2119]</a> in ways based upon similar definitions in ISO/<abbr 392 title="International Electro-technical Commission">IEC</abbr> 393 9945-1:1990 <a href="#ref-posix">[POSIX.1]</a>:</p> 394 395 <dl> 396 <dt>Implementation-defined</dt> 397 398 <dd>A value or behavior is implementation-defined when it is left 399 to the implementation to define [and document] the corresponding 400 requirements for correct document construction.</dd> 401 402 <dt>May</dt> 403 404 <dd>With respect to implementations, the word "may" is to be 405 interpreted as an optional feature that is not required in this 406 specification but can be provided. With respect to <a href= 407 "#docconf">Document Conformance</a>, the word "may" means that 408 the optional feature must not be used. The term "optional" has 409 the same definition as "may".</dd> 410 411 <dt>Must</dt> 412 413 <dd>In this specification, the word "must" is to be interpreted 414 as a mandatory requirement on the implementation or on Strictly 415 Conforming XHTML Documents, depending upon the context. The term 416 "shall" has the same definition as "must".</dd> 417 418 <dt>Reserved</dt> 419 420 <dd>A value or behavior is unspecified, but it is not allowed to 421 be used by Conforming Documents nor to be supported by a 422 Conforming User Agents.</dd> 423 424 <dt>Should</dt> 425 426 <dd>With respect to implementations, the word "should" is to be 427 interpreted as an implementation recommendation, but not a 428 requirement. With respect to documents, the word "should" is to 429 be interpreted as recommended programming practice for documents 430 and a requirement for Strictly Conforming XHTML Documents.</dd> 431 432 <dt>Supported</dt> 433 434 <dd>Certain facilities in this specification are optional. If a 435 facility is supported, it behaves as specified by this 436 specification.</dd> 437 438 <dt>Unspecified</dt> 439 440 <dd>When a value or behavior is unspecified, the specification 441 defines no portability requirements for a facility on an 442 implementation even when faced with a document that uses the 443 facility. A document that requires specific behavior in such an 444 instance, rather than tolerating any behavior when using that 445 facility, is not a Strictly Conforming XHTML Document.</dd> 446 </dl> 447 448 <h2><a name="general" id="general">2.2 General Terms</a></h2> 449 450 <dl> 451 <dt>Attribute</dt> 452 453 <dd>An attribute is a parameter to an element declared in the 454 DTD. An attribute's type and value range, including a possible 455 default value, are defined in the DTD.</dd> 456 457 <dt>DTD</dt> 458 459 <dd>A DTD, or document type definition, is a collection of XML 460 declarations that, as a collection, defines the legal structure, 461 <span class="term">elements</span>, and <span class="term"> 462 attributes</span> that are available for use in a document that 463 complies to the DTD.</dd> 464 465 <dt>Document</dt> 466 467 <dd>A document is a stream of data that, after being combined 468 with any other streams it references, is structured such that it 469 holds information contained within <span class="term"> 470 elements</span> that are organized as defined in the associated 471 <span class="term">DTD</span>. See <a href="#docconf">Document 472 Conformance</a> for more information.</dd> 473 474 <dt>Element</dt> 475 476 <dd>An element is a document structuring unit declared in the 477 <span class="term">DTD</span>. The element's content model is 478 defined in the <span class="term">DTD</span>, and additional 479 semantics may be defined in the prose description of the 480 element.</dd> 481 482 <dt><a name="facilities" id="facilities">Facilities</a></dt> 483 484 <dd>Functionality includes <span class="term">elements</span>, 485 <span class="term">attributes</span>, and the semantics 486 associated with those <span class="term">elements</span> and 487 <span class="term">attributes</span>. An implementation 488 supporting that functionality is said to provide the necessary 489 facilities.</dd> 490 491 <dt>Implementation</dt> 492 493 <dd>An implementation is a system that provides collection of 494 <span class="term">facilities</span> and services that supports 495 this specification. See <a href="#uaconf">User Agent 496 Conformance</a> for more information.</dd> 497 498 <dt>Parsing</dt> 499 500 <dd>Parsing is the act whereby a <span class="term"> 501 document</span> is scanned, and the information contained within 502 the <span class="term">document</span> is filtered into the 503 context of the <span class="term">elements</span> in which the 504 information is structured.</dd> 505 506 <dt>Rendering</dt> 507 508 <dd>Rendering is the act whereby the information in a <span 509 class="term">document</span> is presented. This presentation is 510 done in the form most appropriate to the environment (e.g. 511 aurally, visually, in print).</dd> 512 513 <dt>User Agent</dt> 514 515 <dd>A user agent is an <span class="term">implementation</span> 516 that retrieves and processes XHTML documents. See <a href= 517 "#uaconf">User Agent Conformance</a> for more information.</dd> 518 519 <dt>Validation</dt> 520 521 <dd>Validation is a process whereby <span class="term"> 522 documents</span> are verified against the associated <span class= 523 "term">DTD</span>, ensuring that the structure, use of <span 524 class="term">elements</span>, and use of <span class="term"> 525 attributes</span> are consistent with the definitions in the 526 <span class="term">DTD</span>.</dd> 527 528 <dt><a name="wellformed" id="wellformed">Well-formed</a></dt> 529 530 <dd>A <span class="term">document</span> is well-formed when it 531 is structured according to the rules defined in <a href= 532 "http://www.w3.org/TR/REC-xml#sec-well-formed">Section 2.1</a> of 533 the XML 1.0 Recommendation <a href="#ref-xml">[XML]</a>. 534 Basically, this definition states that elements, delimited by 535 their start and end tags, are nested properly within one 536 another.</dd> 537 </dl> 538 539 <!--OddPage--> 540 <h1><a name="normative" id="normative">3. Normative Definition of 541 XHTML 1.0</a></h1> 542 543 <h2><a name="docconf" id="docconf">3.1 Document 544 Conformance</a></h2> 545 546 <p>This version of XHTML provides a definition of strictly 547 conforming XHTML documents, which are restricted to tags and 548 attributes from the XHTML namespace. See <a href= 549 "#well-formed">Section 3.1.2</a> for information on using XHTML 550 with other namespaces, for instance, to include metadata 551 expressed in <abbr title="Resource Description Format">RDF</abbr> within XHTML documents.</p> 552 553 <h3><a name="strict" id="strict">3.1.1 Strictly Conforming 554 Documents</a></h3> 555 556 <p>A Strictly Conforming XHTML Document is a document that 557 requires only the facilities described as mandatory in this 558 specification. Such a document must meet all of the following 559 criteria:</p> 560 561 <ol> 562 <li> 563 <p>It must validate against one of the three DTDs found in <a 564 href="#dtds">Appendix A</a>.</p> 565 </li> 566 567 <li> 568 <p>The root element of the document must be <code> 569 <html></code>.</p> 570 </li> 571 572 <li> 573 <p>The root element of the document must designate the XHTML 574 namespace using the <code>xmlns</code> attribute <a href= 575 "#ref-xmlns">[XMLNAMES]</a>. The namespace for XHTML is 576 defined to be 577 <code>http://www.w3.org/1999/xhtml</code>.</p> 578 </li> 579 580 <li> 581 <p>There must be a DOCTYPE declaration in the document prior to 582 the root element. The public identifier included in 583 the DOCTYPE declaration must reference one of the three DTDs 584 found in <a href="#dtds">Appendix A</a> using the respective 585 Formal Public Identifier. The system identifier may be changed to reflect 586 local system conventions.</p> 587 588 <pre> 589 <!DOCTYPE html 590 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 591 "http://www.w3.org/TR/1999/PR-xhtml1-19991210/DTD/xhtml1-strict.dtd> 592 593 <!DOCTYPE html 594 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 595 "http://www.w3.org/TR/1999/PR-xhtml1-19991210/DTD/xhtml1-transitional.dtd> 596 597 <!DOCTYPE html 598 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 599 "http://www.w3.org/TR/1999/PR-xhtml1-19991210/DTD/xhtml1-frameset.dtd> 600 </pre> 601 </li> 602 </ol> 603 604 <p>Here is an example of a minimal XHTML document.</p> 605 606 <div class="good"> 607 <pre> 608 <?xml version="1.0" encoding="UTF-8"?> 609 <!DOCTYPE html 610 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 611 "http://www.w3.org/TR/1999/PR-xhtml1-19991210/DTD/xhtml1-strict.dtd"> 612 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 613 <head> 614 <title>Virtual Library</title> 615 </head> 616 <body> 617 <p>Moved to <a href="http://vlib.org/">vlib.org</a>.</p> 618 </body> 619 </html></pre> 620 </div> 621 622 <p>Note that in this example, the XML declaration is included. An XML 623 declaration like the one above is 624 not required in all XML documents. XHTML document authors are strongly encouraged to use XML declarations in all their documents. Such a declaration is required 625 when the character encoding of the document is other than the default UTF-8 or 626 UTF-16.</p> 627 628 <h3><a name="well-formed" id="well-formed">3.1.2 Using XHTML with 629 other namespaces</a></h3> 630 631 <p>The XHTML namespace may be used with other XML namespaces 632 as per <a href="#ref-xmlns">[XMLNAMES]</a>, although such 633 documents are not strictly conforming XHTML 1.0 documents as 634 defined above. Future work by W3C will address ways to specify 635 conformance for documents involving multiple namespaces.</p> 636 637 <p>The following example shows the way in which XHTML 1.0 could 638 be used in conjunction with the MathML Recommendation:</p> 639 640 <div class="good"> 641 <pre> 642 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 643 <head> 644 <title>A Math Example</title> 645 </head> 646 <body> 647 <p>The following is MathML markup:</p> 648 <math xmlns="http://www.w3.org/1998/Math/MathML"> 649 <apply> <log/> 650 <logbase> 651 <cn> 3 </cn> 652 </logbase> 653 <ci> x </ci> 654 </apply> 655 </math> 656 </body> 657 </html> 658 </pre> 659 </div> 660 661 <p>The following example shows the way in which XHTML 1.0 markup 662 could be incorporated into another XML namespace:</p> 663 664 <div class="good"> 665 <pre> 666 <?xml version="1.0" encoding="UTF-8"?> 667 <!-- initially, the default namespace is "books" --> 668 <book xmlns='urn:loc.gov:books' 669 xmlns:isbn='urn:ISBN:0-395-36341-6' xml:lang="en" lang="en"> 670 <title>Cheaper by the Dozen</title> 671 <isbn:number>1568491379</isbn:number> 672 <notes> 673 <!-- make HTML the default namespace for a hypertext commentary --> 674 <p xmlns='http://www.w3.org/1999/xhtml'> 675 This is also available <a href="http://www.w3.org/">online</a>. 676 </p> 677 </notes> 678 </book> 679 </pre> 680 </div> 681 682 <h2><a name="uaconf" id="uaconf">3.2 User Agent 683 Conformance</a></h2> 684 685 <p>A conforming user agent must meet all of the following 686 criteria:</p> 687 688 <ol> 689 <li>In order to be consistent with the XML 1.0 Recommendation <a 690 href="#ref-xml">[XML]</a>, the user agent must parse and evaluate 691 an XHTML document for well-formedness. If the user agent claims 692 to be a validating user agent, it must also validate documents 693 against their referenced DTDs according to <a href="#ref-xml"> 694 [XML]</a>.</li> 695 696 <li>When the user agent claims to support <a href="#facilities"> 697 facilities</a> defined within this specification or required by 698 this specification through normative reference, it must do so in 699 ways consistent with the facilities' definition.</li> 700 701 <li>When a user agent processes an XHTML document as generic XML, 702 it shall only recognize attributes of type 703 <code>ID</code> (e.g. the <code>id</code> attribute on most XHTML elements) 704 as fragment identifiers.</li> 705 706 <li>If a user agent encounters an element it does not recognize, 707 it must render the element's content.</li> 708 709 <li>If a user agent encounters an attribute it does not 710 recognize, it must ignore the entire attribute specification 711 (i.e., the attribute and its value).</li> 712 713 <li>If a user agent encounters an attribute value it doesn't 714 recognize, it must use the default attribute value.</li> 715 716 <li>If it encounters an entity reference (other than one 717 of the predefined entities) for which the User Agent has 718 processed no declaration (which could happen if the declaration 719 is in the external subset which the User Agent hasn't read), the entity 720 reference should be rendered as the characters (starting 721 with the ampersand and ending with the semi-colon) that 722 make up the entity reference.</li> 723 724 <li>When rendering content, User Agents that encounter 725 characters or character entity references that are recognized but not renderable should display the document in such a way that it is obvious to the user that normal rendering has not taken place.</li> 726 727 <li> 728 The following characters are defined in [XML] as whitespace characters: 729 730 <ul> 731 <li>Space (&#x0020;)</li> 732 <li>Tab (&#x0009;)</li> 733 <li>Carriage return (&#x000D;)</li> 734 <li>Line feed (&#x000A;)</li> 735 </ul> 736 737 <p> 738 The XML processor normalizes different system's line end codes into one 739 single line-feed character, that is passed up to the application. The XHTML 740 user agent in addition, must treat the following characters as whitespace: 741 </p> 742 743 <ul> 744 <li>Form feed (&#x000C;)</li> 745 <li>Zero-width space (&#x200B;)</li> 746 </ul> 747 748 <p> 749 In elements where the 'xml:space' attribute is set to 'preserve', the user 750 agent must leave all whitespace characters intact (with the exception of 751 leading and trailing whitespace characters, which should be removed). 752 Otherwise, whitespace 753 is handled according to the following rules: 754 </p> 755 756 <ul> 757 <li> 758 All whitespace surrounding block elements should be removed. 759 </li> 760 <li> 761 Comments are removed entirely and do not affect whitespace handling. One 762 whitespace character on either side of a comment is treated as two white 763 space characters. 764 </li> 765 <li> 766 Leading and trailing whitespace inside a block element must be removed. 767 </li> 768 <li>Line feed characters within a block element must be converted into a 769 space (except when the 'xml:space' attribute is set to 'preserve'). 770 </li> 771 <li> 772 A sequence of white space characters must be reduced to a single space 773 character (except when the 'xml:space' attribute is set to 'preserve'). 774 </li> 775 <li> 776 With regard to rendition, 777 the User Agent should render the content in a 778 manner appropriate to the language in which the content is written. 779 In languages whose primary script is Latinate, the ASCII space 780 character is typically used to encode both grammatical word boundaries and 781 typographic whitespace; in languages whose script is related to Nagari 782 (e.g., Sanskrit, Thai, etc.), grammatical boundaries may be encoded using 783 the ZW 'space' character, but will not typically be represented by 784 typographic whitespace in rendered output; languages using Arabiform scripts 785 may encode typographic whitespace using a space character, but may also use 786 the ZW space character to delimit 'internal' grammatical boundaries (what 787 look like words in Arabic to an English eye frequently encode several words, 788 e.g. 'kitAbuhum' = 'kitAbu-hum' = 'book them' == their book); and languages 789 in the Chinese script tradition typically neither encode such delimiters nor 790 use typographic whitespace in this way. 791 </li> 792 </ul> 793 794 <p>Whitespace in attribute values is processed according to <a 795 href="#ref-xml">[XML]</a>.</p> 796 </li> 797 </ol> 798 799 <!--OddPage--> 800 <h1><a name="diffs" id="diffs">4. Differences with HTML 801 4.0</a></h1> 802 803 <p>Due to the fact that XHTML is an XML application, certain 804 practices that were perfectly legal in SGML-based HTML 4.0 <a 805 href="#ref-html4">[HTML]</a> must be changed.</p> 806 807 <h2><a name="h-4.1" id="h-4.1">4.1 Documents must be 808 well-formed</a></h2> 809 810 <p><a href="#wellformed">Well-formedness</a> is a new concept 811 introduced by <a href="#ref-xml">[XML]</a>. Essentially this 812 means that all elements must either have closing tags or be 813 written in a special form (as described below), and that all the 814 elements must nest.</p> 815 816 <p>Although overlapping is illegal in SGML, it was widely 817 tolerated in existing browsers.</p> 818 819 <div class="good"> 820 <p><strong><em>CORRECT: nested elements.</em></strong></p> 821 822 <p><p>here is an emphasized 823 <em>paragraph</em>.</p></p> 824 </div> 825 826 <div class="bad"> 827 <p><strong><em>INCORRECT: overlapping elements</em></strong></p> 828 829 <p><p>here is an emphasized 830 <em>paragraph.</p></em></p> 831 </div> 832 833 <h2><a name="h-4.2" id="h-4.2">4.2 Element and attribute 834 names must be in lower case</a></h2> 835 836 <p>XHTML documents must use lower case for all HTML element and 837 attribute names. This difference is necessary because XML is 838 case-sensitive e.g. <li> and <LI> are different 839 tags.</p> 840 841 <h2><a name="h-4.3" id="h-4.3">4.3 For non-empty elements, 842 end tags are required</a></h2> 843 844 <p>In SGML-based HTML 4.0 certain elements were permitted to omit 845 the end tag; with the elements that followed implying closure. 846 This omission is not permitted in XML-based XHTML. All elements 847 other than those declared in the DTD as <code>EMPTY</code> must 848 have an end tag.</p> 849 850 <div class="good"> 851 <p><strong><em>CORRECT: terminated elements</em></strong></p> 852 853 <p><p>here is a paragraph.</p><p>here is 854 another paragraph.</p></p> 855 </div> 856 857 <div class="bad"> 858 <p><strong><em>INCORRECT: unterminated elements</em></strong></p> 859 860 <p><p>here is a paragraph.<p>here is another 861 paragraph.</p> 862 </div> 863 864 <h2><a name="h-4.4" id="h-4.4">4.4 Attribute values must 865 always be quoted</a></h2> 866 867 <p>All attribute values must be quoted, even those which appear 868 to be numeric.</p> 869 870 <div class="good"> 871 <p><strong><em>CORRECT: quoted attribute values</em></strong></p> 872 873 <p><table rows="3"></p> 874 </div> 875 876 <div class="bad"> 877 <p><strong><em>INCORRECT: unquoted attribute values</em></strong></p> 878 879 <p><table rows=3></p> 880 </div> 881 882 <h2><a name="h-4.5" id="h-4.5">4.5 Attribute 883 Minimization</a></h2> 884 885 <p>XML does not support attribute minimization. Attribute-value 886 pairs must be written in full. Attribute names such as <code> 887 compact</code> and <code>checked</code> cannot occur in elements 888 without their value being specified.</p> 889 890 <div class="good"> 891 <p><strong><em>CORRECT: unminimized attributes</em></strong></p> 892 893 <p><dl compact="compact"></p> 894 </div> 895 896 <div class="bad"> 897 <p><strong><em>INCORRECT: minimized attributes</em></strong></p> 898 899 <p><dl compact></p> 900 </div> 901 902 <h2><a name="h-4.6" id="h-4.6">4.6 Empty Elements</a></h2> 903 904 <p>Empty elements must either have an end tag or the start tag must end with <code>/></code>. For instance, 905 <code><br/></code> or <code><hr></hr></code>. See <a 906 href="#guidelines">HTML Compatibility Guidelines</a> for information on ways to 907 ensure this is backward compatible with HTML 4.0 user agents.</p> 908 909 <div class="good"> 910 <p><strong><em>CORRECT: terminated empty tags</em></strong></p> 911 912 <p><br/><hr/></p> 913 </div> 914 915 <div class="bad"> 916 <p><strong><em>INCORRECT: unterminated empty tags</em></strong></p> 917 918 <p><br><hr></p> 919 </div> 920 921 <h2><a name="h-4.7" id="h-4.7">4.7 Whitespace handling in 922 attribute values</a></h2> 923 924 <p>In attribute values, user agents will strip leading and 925 trailing whitespace from attribute values and map sequences 926 of one or more whitespace characters (including line breaks) to 927 a single inter-word space (an ASCII space character for western 928 scripts). See <a href="http://www.w3.org/TR/REC-xml#AVNormalize"> 929 Section 3.3.3</a> of <a href="#ref-xml">[XML]</a>.</p> 930 931 <h2><a name="h-4.8" id="h-4.8">4.8 Script and Style 932 elements</a></h2> 933 934 <p>In XHTML, the script and style elements are declared as having 935 <code>#PCDATA</code> content. As a result, <code><</code> and 936 <code>&</code> will be treated as the start of markup, and 937 entities such as <code>&lt;</code> and <code>&amp;</code> 938 will be recognized as entity references by the XML processor to 939 <code><</code> and <code>&</code> respectively. Wrapping 940 the content of the script or style element within a <code> 941 CDATA</code> marked section avoids the expansion of these 942 entities.</p> 943 944 <div class="good"> 945 <pre> 946 <script> 947 <![CDATA[ 948 ... unescaped script content ... 949 ]]> 950 </script> 951 </pre> 952 </div> 953 954 <p><code>CDATA</code> sections are recognized by the XML 955 processor and appear as nodes in the Document Object Model, see 956 <a href= 957 "http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-E067D597"> 958 Section 1.3</a> of the DOM Level 1 Recommendation <a href= 959 "#ref-dom">[DOM]</a>.</p> 960 961 <p>An alternative is to use external script and style 962 documents.</p> 963 964 <h2><a name="h-4.9" id="h-4.9">4.9 SGML exclusions</a></h2> 965 966 <p>SGML gives the writer of a DTD the ability to exclude specific 967 elements from being contained within an element. Such 968 prohibitions (called "exclusions") are not possible in XML.</p> 969 970 <p>For example, the HTML 4.0 Strict DTD forbids the nesting of an 971 '<code>a</code>' element within another '<code>a</code>' element 972 to any descendant depth. It is not possible to spell out such 973 prohibitions in XML. Even though these prohibitions cannot be 974 defined in the DTD, certain elements should not be nested. A 975 summary of such elements and the elements that should not be 976 nested in them is found in the normative <a href="#prohibitions"> 977 Appendix B</a>.</p> 978 979 <h2><a name="h-4.10" id="h-4.10">4.10 The elements with 'id' and 'name' 980 attributes</a></h2> 981 982 <p>HTML 4.0 defined the <code>name</code> attribute for the elements 983 <code>a</code>, 984 <code>applet</code>, <code>frame</code>, 985 <code>iframe</code>, <code>img</code>, and <code>map</code>. 986 HTML 4.0 also introduced 987 the <code>id</code> attribute. Both of these attributes are designed to be 988 used as fragment identifiers.</p> 989 <p>In XML, fragment identifiers are of type <code>ID</code>, and 990 there can only be a single attribute of type <code>ID</code> per element. 991 Therefore, in XHTML 1.0 the <code>id</code> 992 attribute is defined to be of type <code>ID</code>. In order to 993 ensure that XHTML 1.0 documents are well-structured XML documents, XHTML 1.0 994 documents MUST use the <code>id</code> attribute when defining fragment 995 identifiers, even on elements that historically have also had a 996 <code>name</code> attribute. 997 See the <a href="#guidelines">HTML Compatibility 998 Guidelines</a> for information on ensuring such anchors are backwards 999 compatible when serving XHTML documents as media type <code>text/html</code>. 1000 </p> 1001 <p>Note that in XHTML 1.0, the <code>name</code> attribute of these 1002 elements is formally deprecated, and will be removed in a 1003 subsequent version of XHTML.</p> 1004 1005 <!--OddPage--> 1006 <h1><a name="issues" id="issues">5. Compatibility Issues</a></h1> 1007 1008 <p>Although there is no requirement for XHTML 1.0 documents to be 1009 compatible with existing user agents, in practice this is easy to 1010 accomplish. Guidelines for creating compatible documents can be 1011 found in <a href="#guidelines">Appendix C</a>.</p> 1012 1013 <h2><a name="media" id="media">5.1 Internet Media Type</a></h2> 1014 <p>As of the publication of this recommendation, the general 1015 recommended MIME labeling for XML-based applications 1016 has yet to be resolved.</p> 1017 1018 <p>However, XHTML Documents which follow the guidelines set forth 1019 in <a href="#guidelines">Appendix C</a>, "HTML Compatibility Guidelines" may be 1020 labeled with the Internet Media Type "text/html", as they 1021 are compatible with most HTML browsers. This document 1022 makes no recommendation about MIME labeling of other 1023 XHTML documents.</p> 1024 1025 <!--OddPage--> 1026 <h1><a name="future" id="future">6. Future Directions</a></h1> 1027 1028 <p>XHTML 1.0 provides the basis for a family of document types 1029 that will extend and subset XHTML, in order to support a wide 1030 range of new devices and applications, by defining modules and 1031 specifying a mechanism for combining these modules. This 1032 mechanism will enable the extension and sub-setting of XHTML 1.0 1033 in a uniform way through the definition of new modules.</p> 1034 1035 <h2><a name="mods" id="mods">6.1 Modularizing HTML</a></h2> 1036 1037 <p>As the use of XHTML moves from the traditional desktop user 1038 agents to other platforms, it is clear that not all of the XHTML 1039 elements will be required on all platforms. For example a hand 1040 held device or a cell-phone may only support a subset of XHTML 1041 elements.</p> 1042 1043 <p>The process of modularization breaks XHTML up into a series of 1044 smaller element sets. These elements can then be recombined to 1045 meet the needs of different communities.</p> 1046 1047 <p>These modules will be defined in a later W3C document.</p> 1048 1049 <h2><a name="extensions" id="extensions">6.2 Subsets and 1050 Extensibility</a></h2> 1051 1052 <p>Modularization brings with it several advantages:</p> 1053 1054 <ul> 1055 <li> 1056 <p>It provides a formal mechanism for sub-setting XHTML.</p> 1057 </li> 1058 1059 <li> 1060 <p>It provides a formal mechanism for extending XHTML.</p> 1061 </li> 1062 1063 <li> 1064 <p>It simplifies the transformation between document types.</p> 1065 </li> 1066 1067 <li> 1068 <p>It promotes the reuse of modules in new document types.</p> 1069 </li> 1070 </ul> 1071 1072 <h2><a name="profiles" id="profiles">6.3 Document 1073 Profiles</a></h2> 1074 1075 <p>A document profile specifies the syntax and semantics of a set 1076 of documents. Conformance to a document profile provides a basis 1077 for interoperability guarantees. The document profile specifies 1078 the facilities required to process documents of that type, e.g. 1079 which image formats can be used, levels of scripting, style sheet 1080 support, and so on.</p> 1081 1082 <p>For product designers this enables various groups to define 1083 their own standard profile.</p> 1084 1085 <p>For authors this will obviate the need to write several 1086 different versions of documents for different clients.</p> 1087 1088 <p>For special groups such as chemists, medical doctors, or 1089 mathematicians this allows a special profile to be built using 1090 standard HTML elements plus a group of elements geared to the 1091 specialist's needs.</p> 1092 1093 <!--OddPage--> 1094 <h1><a name="appendices" id="appendices"></a> 1095 <a name="dtds" id="dtds">Appendix A. DTDs</a></h1> 1096 1097 <p><b>This appendix is normative.</b></p> 1098 1099 <p>These DTDs and entity sets form a normative part of this 1100 specification. The complete set of DTD files together with an XML 1101 declaration and SGML Open Catalog is included in the <a href= 1102 "xhtml1.zip">zip file</a> for this specification.</p> 1103 1104 <h2><a name="h-A1" id="h-A1">A.1 Document Type 1105 Definitions</a></h2> 1106 1107 <p>These DTDs approximate the HTML 4.0 DTDs. It is likely that 1108 when the DTDs are modularized, a method of DTD construction will 1109 be employed that corresponds more closely to HTML 4.0.</p> 1110 1111 <ul> 1112 <li> 1113 <p><a href="DTD/xhtml1-strict.dtd" type="text/plain"> 1114 XHTML-1.0-Strict</a></p> 1115 </li> 1116 1117 <li> 1118 <p><a href="DTD/xhtml1-transitional.dtd" type="text/plain"> 1119 XHTML-1.0-Transitional</a></p> 1120 </li> 1121 1122 <li> 1123 <p><a href="DTD/xhtml1-frameset.dtd" type="text/plain"> 1124 XHTML-1.0-Frameset</a></p> 1125 </li> 1126 </ul> 1127 1128 <h2><a name="h-A2" id="h-A2">A.2 Entity Sets</a></h2> 1129 1130 <p>The XHTML entity sets are the same as for HTML 4.0, but have 1131 been modified to be valid XML 1.0 entity declarations. Note the 1132 entity for the Euro currency sign (<code>&euro;</code> or 1133 <code>&#8364;</code> or <code>&#x20AC;</code>) is defined 1134 as part of the special characters.</p> 1135 1136 <ul> 1137 <li> 1138 <p><a href="DTD/xhtml-lat1.ent">Latin-1 characters</a></p> 1139 </li> 1140 1141 <li> 1142 <p><a href="DTD/xhtml-special.ent">Special characters</a></p> 1143 </li> 1144 1145 <li> 1146 <p><a href="DTD/xhtml-symbol.ent">Symbols</a></p> 1147 </li> 1148 </ul> 1149 1150 <!--OddPage--> 1151 <h1><a name="prohibitions" id="prohibitions">Appendix B. Element 1152 Prohibitions</a></h1> 1153 1154 <p><b>This appendix is normative.</b></p> 1155 1156 <p>The following elements have prohibitions on which elements 1157 they can contain (see <a href="#h-4.9">Section 4.9</a>). This 1158 prohibition applies to all depths of nesting, i.e. it contains 1159 all the descendant elements.</p> 1160 1161 <dl><dt><code class="tag">a</code></dt> 1162 <dd> 1163 cannot contain other <code>a</code> elements.</dd> 1164 <dt><code class="tag">pre</code></dt> 1165 <dd>cannot contain the <code>img</code>, <code>object</code>, 1166 <code>big</code>, <code>small</code>, <code>sub</code>, or <code> 1167 sup</code> elements.</dd> 1168 1169 <dt><code class="tag">button</code></dt> 1170 <dd>cannot contain the <code>input</code>, <code>select</code>, 1171 <code>textarea</code>, <code>label</code>, <code>button</code>, 1172 <code>form</code>, <code>fieldset</code>, <code>iframe</code> or 1173 <code>isindex</code> elements.</dd> 1174 <dt><code class="tag">label</code></dt> 1175 <dd>cannot contain other <code class="tag">label</code> elements.</dd> 1176 <dt><code class="tag">form</code></dt> 1177 <dd>cannot contain other <code>form</code> elements.</dd> 1178 </dl> 1179 1180 <!--OddPage--> 1181 <h1><a name="guidelines" id="guidelines">Appendix C. 1182 HTML Compatibility Guidelines</a></h1> 1183 1184 <p><b>This appendix is informative.</b></p> 1185 1186 <p>This appendix summarizes design guidelines for authors who 1187 wish their XHTML documents to render on existing HTML user 1188 agents.</p> 1189 1190 <h2>C.1 Processing Instructions</h2> 1191 <p>Be aware that processing instructions are rendered on some 1192 user agents. However, also note that when the XML declaration is not included 1193 in a document, the document can only use the default character encodings UTF-8 1194 or UTF-16.</p> 1195 1196 <h2>C.2 Empty Elements</h2> 1197 <p>Include a space before the trailing <code>/</code> and <code> 1198 ></code> of empty elements, e.g. <code class="greenmono"> 1199 <br /></code>, <code class="greenmono"> 1200 <hr /></code> and <code class="greenmono"><img 1201 src="karen.jpg" alt="Karen" /></code>. Also, use the 1202 minimized tag syntax for empty elements, e.g. <code class= 1203 "greenmono"><br /></code>, as the alternative syntax <code 1204 class="greenmono"><br></br></code> allowed by XML 1205 gives uncertain results in many existing user agents.</p> 1206 1207 <h2>C.3 Element Minimization and Empty Element Content</h2> 1208 <p>Given an empty instance of an element whose content model is 1209 not <code>EMPTY</code> (for example, an empty title or paragraph) 1210 do not use the minimized form (e.g. use <code class="greenmono"> 1211 <p> </p></code> and not <code class="greenmono"> 1212 <p /></code>).</p> 1213 1214 <h2>C.4 Embedded Style Sheets and Scripts</h2> 1215 <p>Use external style sheets if your style sheet uses <code> 1216 <</code> or <code>&</code> or <code>]]></code> or <code>--</code>. Use 1217 external scripts if your script uses <code><</code> or <code> 1218 &</code> or <code>]]></code> or <code>--</code>. Note that XML parsers 1219 are permitted to silently remove the contents of comments. Therefore, the historical 1220 practice of "hiding" scripts and style sheets within comments to make the 1221 documents backward compatible is likely to not work as expected in XML-based 1222 implementations.</p> 1223 1224 <h2>C.5 Line Breaks within Attribute Values</h2> 1225 <p>Avoid line breaks and multiple whitespace characters within 1226 attribute values. These are handled inconsistently by user 1227 agents.</p> 1228 1229 <h2>C.6 Isindex</h2> 1230 <p>Don't include more than one <code>isindex</code> element in 1231 the document <code>head</code>. The <code>isindex</code> element 1232 is deprecated in favor of the <code>input</code> element.</p> 1233 1234 <h2>C.7 The <code>lang</code> and <code>xml:lang</code> Attributes</h2> 1235 <p>Use both the <code>lang</code> and <code>xml:lang</code> 1236 attributes when specifying the language of an element. The value 1237 of the <code>xml:lang</code> attribute takes precedence.</p> 1238 1239 <h2>C.8 Fragment Identifiers</h2> 1240 <p>In XML, <abbr title="Uniform Resource Identifiers">URIs</abbr> [<a href="#ref-rfc2396">RFC2396</a>] that end with fragment identifiers of the form 1241 <code>"#foo"</code> do not refer to elements with an attribute 1242 <code>name="foo"</code>; rather, they refer to elements with an 1243 attribute defined to be of type <code>ID</code>, e.g., the <code> 1244 id</code> attribute in HTML 4.0. Many existing HTML clients don't 1245 support the use of <code>ID</code>-type attributes in this way, 1246 so identical values may be supplied for both of these attributes to ensure 1247 maximum forward and backward compatibility (e.g., <code class= 1248 "greenmono"><a id="foo" name="foo">...</a></code>).</p> 1249 1250 <p>Further, since the set of 1251 legal values for attributes of type <code>ID</code> is much smaller than 1252 for those of type <code>CDATA</code>, the type of the <code>name</code> 1253 attribute has been changed to <code>NMTOKEN</code>. This attribute is 1254 constrained such that it can only have the same values as type 1255 <code>ID</code>, or as the <code>Name</code> production in XML 1.0 Section 1256 2.5, production 5. Unfortunately, this constraint cannot be expressed in the 1257 XHTML 1.0 DTDs. Because of this change, care must be taken when 1258 converting existing HTML documents. The values of these attributes 1259 must be unique within the document, valid, and any references to these 1260 fragment identifiers (both 1261 internal and external) must be updated should the values be changed during 1262 conversion.</p> 1263 <p>Finally, note that XHTML 1.0 has deprecated the 1264 <code>name</code> attribute of the <code>a</code>, <code>applet</code>, <code>frame</code>, <code>iframe</code>, <code>img</code>, and <code>map</code> 1265 elements, and it will be 1266 removed from XHTML in subsequent versions.</p> 1267 1268 <h2>C.9 Character Encoding</h2> 1269 <p>To specify a character encoding in the document, use both the 1270 encoding attribute specification on the xml declaration (e.g. 1271 <code class="greenmono"><?xml version="1.0" 1272 encoding="EUC-JP"?></code>) and a meta http-equiv statement 1273 (e.g. <code class="greenmono"><meta http-equiv="Content-type" 1274 content='text/html; charset="EUC-JP"' /></code>). The 1275 value of the encoding attribute of the xml processing instruction 1276 takes precedence.</p> 1277 1278 <h2>C.10 Boolean Attributes</h2> 1279 <p>Some HTML user agents are unable to interpret boolean 1280 attributes when these appear in their full (non-minimized) form, 1281 as required by XML 1.0. Note this problem doesn't effect user 1282 agents compliant with HTML 4.0. The following attributes are 1283 involved: <code>compact</code>, <code>nowrap</code>, <code> 1284 ismap</code>, <code>declare</code>, <code>noshade</code>, <code> 1285 checked</code>, <code>disabled</code>, <code>readonly</code>, 1286 <code>multiple</code>, <code>selected</code>, <code> 1287 noresize</code>, <code>defer</code>.</p> 1288 1289 <h2>C.11 Document Object Model and XHTML</h2> 1290 <p> 1291 The Document Object Model level 1 Recommendation [<a href="#ref-dom">DOM</a>] 1292 defines document object model interfaces for XML and HTML 4.0. The HTML 4.0 1293 document object model specifies that HTML element and attribute names are 1294 returned in upper-case. The XML document object model specifies that 1295 element and attribute names are returned in the case they are specified. In 1296 XHTML 1.0, elements and attributes are specified in lower-case. This apparent difference can be 1297 addressed in two ways: 1298 </p> 1299 <ol> 1300 <li>Applications that access XHTML documents served as Internet media type 1301 <code>text/html</code> 1302 via the <abbr title="Document Object Model">DOM</abbr> can use the HTML DOM, 1303 and can rely upon element and attribute names being returned in 1304 upper-case from those interfaces.</li> 1305 <li>Applications that access XHTML documents served as Internet media types 1306 <code>text/xml</code> or <code>application/xml</code> 1307 can also use the XML DOM. Elements and attributes will be returned in lower-case. 1308 Also, some XHTML elements may or may 1309 not appear 1310 in the object tree because they are optional in the content model 1311 (e.g. the <code>tbody</code> element within 1312 <code>table</code>). This occurs because in HTML 4.0 some elements were 1313 permitted to be minimized such that their start and end tags are both omitted 1314 (an SGML feature). 1315 This is not possible in XML. Rather than require document authors to insert 1316 extraneous elements, XHTML has made the elements optional. 1317 Applications need to adapt to this 1318 accordingly.</li> 1319 </ol> 1320 1321 <h2>C.12 Using Ampersands in Attribute Values</h2> 1322 <p> 1323 When an attribute value contains an ampersand, it must be expressed as a character 1324 entity reference 1325 (e.g. "<code>&amp;</code>"). For example, when the 1326 <code>href</code> attribute 1327 of the <code>a</code> element refers to a 1328 CGI script that takes parameters, it must be expressed as 1329 <code>http://my.site.dom/cgi-bin/myscript.pl?class=guest&name=user</code> 1330 rather than as 1331 <code>http://my.site.dom/cgi-bin/myscript.pl?class=guest&name=user</code>. 1332 </p> 1333 1334 <h2>C.13 Cascading Style Sheets (CSS) and XHTML</h2> 1335 1336 <p>The Cascading Style Sheets level 2 Recommendation [<a href="#ref-css2">CSS2</a>] defines style 1337 properties which are applied to the parse tree of the HTML or XML 1338 document. Differences in parsing will produce different visual or 1339 aural results, depending on the selectors used. The following hints 1340 will reduce this effect for documents which are served without 1341 modification as both media types:</p> 1342 1343 <ol> 1344 <li> 1345 CSS style sheets for XHTML should use lower case element and 1346 attribute names.</li> 1347 1348 1349 <li>In tables, the tbody element will be inferred by the parser of an 1350 HTML user agent, but not by the parser of an XML user agent. Therefore 1351 you should always explicitely add a tbody element if it is referred to 1352 in a CSS selector.</li> 1353 1354 <li>Within the XHTML name space, user agents are expected to 1355 recognize the "id" attribute as an attribute of type ID. 1356 Therefore, style sheets should be able to continue using the 1357 shorthand "#" selector syntax even if the user agent does not read 1358 the DTD.</li> 1359 1360 <li>Within the XHTML name space, user agents are expected to 1361 recognize the "class" attribute. Therefore, style sheets should be 1362 able to continue using the shorthand "." selector syntax.</li> 1363 1364 <li> 1365 CSS defines different conformance rules for HTML and XML documents; 1366 be aware that the HTML rules apply to XHTML documents delivered as 1367 HTML and the XML rules apply to XHTML documents delivered as XML.</li> 1368 </ol> 1369 <!--OddPage--> 1370 <h1><a name="acks" id="acks">Appendix D. 1371 Acknowledgements</a></h1> 1372 1373 <p><b>This appendix is informative.</b></p> 1374 1375 <p>This specification was written with the participation of the 1376 members of the W3C HTML working group:</p> 1377 1378 <dl> 1379 <dd>Steven Pemberton, CWI (HTML Working Group Chair)<br /> 1380 Murray Altheim, Sun Microsystems<br /> 1381 Daniel Austin, CNET: The Computer Network<br /> 1382 Frank Boumphrey, HTML Writers Guild<br /> 1383 John Burger, Mitre<br /> 1384 Andrew W. Donoho, IBM<br /> 1385 Sam Dooley, IBM<br /> 1386 Klaus Hofrichter, GMD<br /> 1387 Philipp Hoschka, W3C<br /> 1388 Masayasu Ishikawa, W3C<br /> 1389 Warner ten Kate, Philips Electronics<br /> 1390 Peter King, Phone.com<br /> 1391 Paula Klante, JetForm<br /> 1392 Shin'ichi Matsui, W3C/Panasonic<br /> 1393 Shane McCarron, Applied Testing and Technology (The Open Group through August 1394 1999)<br /> 1395 Ann Navarro, HTML Writers Guild<br /> 1396 Zach Nies, Quark<br /> 1397 Dave Raggett, W3C/HP (W3C lead for HTML)<br /> 1398 Patrick Schmitz, Microsoft<br /> 1399 Sebastian Schnitzenbaumer, Stack Overflow<br /> 1400 Chris Wilson, Microsoft<br /> 1401 Ted Wugofski, Gateway 2000<br /> 1402 Dan Zigmond, WebTV Networks</dd> 1403 </dl> 1404 1405 <!--OddPage--> 1406 <h1><a name="refs" id="refs">Appendix E. References</a></h1> 1407 1408 <p><b>This appendix is informative.</b></p> 1409 1410 <dl> 1411 1412 <dt><a name="ref-css2" id="ref-css2"><b>[CSS2]</b></a></dt> 1413 1414 <dd><a href="http://www.w3.org/TR/REC-CSS2">"Cascading Style Sheets, level 2 (CSS2) Specification"</a>, B. 1415 Bos, H. W. Lie, C. Lilley, I. Jacobs, 12 May 1998.<br /> 1416 Available at: <a href="http://www.w3.org/TR/REC-CSS2"> 1417 http://www.w3.org/TR/REC-CSS2</a></dd> 1418 1419 <dt><a name="ref-dom" id="ref-dom"><b>[DOM]</b></a></dt> 1420 1421 <dd><a href="http://www.w3.org/TR/REC-DOM-Level-1">"Document Object Model (DOM) Level 1 Specification"</a>, Lauren 1422 Wood <i>et al.</i>, 1 October 1998.<br /> 1423 Available at: <a href="http://www.w3.org/TR/REC-DOM-Level-1"> 1424 http://www.w3.org/TR/REC-DOM-Level-1</a></dd> 1425 1426 <dt><a name="ref-html4" id="ref-html4"><b>[HTML]</b></a></dt> 1427 1428 <dd><a href="http://www.w3.org/TR/1999/PR-html40-19990824">"HTML 4.01 Specification"</a>, D. Raggett, A. Le Hors, I. 1429 Jacobs, 24 August 1999.<br /> 1430 Available at: <a href="http://www.w3.org/TR/1999/PR-html40-19990824"> 1431 http://www.w3.org/TR/1999/PR-html40-19990824</a></dd> 1432 1433 <dt><a name="ref-posix" id="ref-posix"><b>[POSIX.1]</b></a></dt> 1434 1435 <dd>"ISO/IEC 9945-1:1990 Information Technology - Portable 1436 Operating System Interface (POSIX) - Part 1: System Application 1437 Program Interface (API) [C Language]", Institute of Electrical 1438 and Electronics Engineers, Inc, 1990.</dd> 1439 1440 <dt><a name="ref-rfc2046" id="ref-rfc2046"><b> 1441 [RFC2046]</b></a></dt> 1442 1443 <dd><a href="http://www.ietf.org/rfc/rfc2046.txt">"RFC2046: Multipurpose Internet Mail Extensions (MIME) Part 1444 Two: Media Types"</a>, N. Freed and N. Borenstein, November 1445 1996.<br /> 1446 Available at <a href="http://www.ietf.org/rfc/rfc2046.txt"> 1447 http://www.ietf.org/rfc/rfc2046.txt</a>. Note that this RFC 1448 obsoletes RFC1521, RFC1522, and RFC1590.</dd> 1449 1450 <dt><a name="ref-rfc2119" id="ref-rfc2119"><b> 1451 [RFC2119]</b></a></dt> 1452 1453 <dd><a href="http://www.ietf.org/rfc/rfc2119.txt">"RFC2119: Key words for use in RFCs to Indicate Requirement 1454 Levels"</a>, S. Bradner, March 1997.<br /> 1455 Available at: <a href="http://www.ietf.org/rfc/rfc2119.txt"> 1456 http://www.ietf.org/rfc/rfc2119.txt</a></dd> 1457 1458 <dt><a name="ref-rfc2376" id="ref-rfc2376"><b> 1459 [RFC2376]</b></a></dt> 1460 1461 <dd><a href="http://www.ietf.org/rfc/rfc2376.txt">"RFC2376: XML Media Types"</a>, E. Whitehead, M. Murata, July 1462 1998.<br /> 1463 Available at: <a href="http://www.ietf.org/rfc/rfc2376.txt"> 1464 http://www.ietf.org/rfc/rfc2376.txt</a></dd> 1465 1466 <dt><a name="ref-rfc2396" id="ref-rfc2396"><b> 1467 [RFC2396]</b></a></dt> 1468 1469 <dd><a href="http://www.ietf.org/rfc/rfc2396.txt">"RFC2396: Uniform Resource Identifiers (URI): Generic 1470 Syntax"</a>, T. Berners-Lee, R. Fielding, L. Masinter, August 1471 1998.<br /> 1472 This document updates RFC1738 and RFC1808.<br /> 1473 Available at: <a href="http://www.ietf.org/rfc/rfc2396.txt"> 1474 http://www.ietf.org/rfc/rfc2396.txt</a></dd> 1475 1476 <dt><a name="ref-xml" id="ref-xml"><b>[XML]</b></a></dt> 1477 1478 <dd><a href="http://www.w3.org/TR/REC-xml">"Extensible Markup Language (XML) 1.0 Specification"</a>, T. 1479 Bray, J. Paoli, C. M. Sperberg-McQueen, 10 February 1998.<br /> 1480 Available at: <a href="http://www.w3.org/TR/REC-xml"> 1481 http://www.w3.org/TR/REC-xml</a></dd> 1482 1483 <dt><a name="ref-xmlns" id="ref-xmlns"><b>[XMLNAMES]</b></a></dt> 1484 1485 <dd><a href="http://www.w3.org/TR/REC-xml-names">"Namespaces in XML"</a>, T. Bray, D. Hollander, A. Layman, 14 1486 January 1999.<br /> 1487 XML namespaces provide a simple method for qualifying names used 1488 in XML documents by associating them with namespaces identified 1489 by URI.<br /> 1490 Available at: <a href="http://www.w3.org/TR/REC-xml-names"> 1491 http://www.w3.org/TR/REC-xml-names</a></dd> 1492 1493 </dl> 1494 <p><a href="http://www.w3.org/WAI/WCAG1AAA-Conformance" 1495 title="Explanation of Level Triple-A Conformance"> 1496 <img height="32" width="88" 1497 src="wcag1AAA.gif" 1498 alt="Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0" /></a></p> 1499 <div class="navbar"> 1500 <hr /> 1501 <a href="#toc">table of contents</a> 1502 </div> 1503 </body> 1504 </html> 1505 1506