Moving Toward Xhtml 2
Total Page:16
File Type:pdf, Size:1020Kb
Copyright • Copyright © 2003 John Cowan MOVING TOWARD • Licensed under the GNU General Public License • ABSOLUTELY NO WARRANTIES; USE AT YOUR OWN RISK XHTML 2 • Black and white for readability • The Gentium font available at http://www.sil.org/~gaultney/gentium John Cowan Associated Press 1 2 Roadmap Roadmap • Introduction (10 slides) • The Common Attributes (19 slides) • Goals and Principles (8 slides) • XML Events (11 slides) • New and Nifty (8 slides) • XForms (19 slides) • What's History (7 slides) • To Be Continued... (1 slide) • The Elements (27 slides) 3 4 Versions of HTML • HTML 1.0 – simple hypertext INTRODUCTION • HTML 2.0 – images and forms • HTML 3.2 – the union of the browsers • HTML 4.01 – the kitchen sink • XHTML 1.0 – it's XML time • XHTML 1.1 – modularization • XHTML 2 – simple and powerful hypertext 5 6 What is XHTML 2? XHTML 2 Abstract • An evolving standard currently being XHTML 2 is a general purpose markup worked on by the HTML Working Group of language designed for representing the W3C. documents for a wide range of purposes • The first major change to the semantics of across the World Wide Web. To this end it HTML since HTML 4.0. does not attempt to be all things to all people, supplying every possible markup idiom, but to – Obsolete syntax has been discarded supply a generally useful set of elements. – Separation of content and presentation essentially complete – Genuinely new features being introduced 7 8 Why design XHTML 2? Why plan for XHTML 2? • More usable • Predicting the degree of market uptake not • More accessible to different kinds of users yet possible and display devices • Support for legacy HTML will probably be • Easier to write by hand or with tools provided forever for practical reasons • Less reliant on embedded scripting • Avoiding most deprecated and obsolete languages for commonly used functionality features is already possible • The planner's rule of thumb: “Plan or be planned for” 9 10 Making early adoption easy Who supports XHTML 2? • Much HTML is already generated using • Too soon for formal commitments XSLT from one of many XML formats • Server-side support is straightforward • XHTML 2 can be generated just as easily • Cross-platform open-source browsers will • Early-adopting clients can get a better almost certainly support XHTML 2 fairly browsing experience quickly and easily • The WG contains several major browser companies 11 12 Constructing document types Everything is subject to change • XHTML 2 has a fully modular definition • This presentation is based on the July 2006 • Defining subsets for use within other public working draft of XHTML 2 document types will be easy, for: • Disclaimer: not every slide is 100% updated – rich textual annotations to the very latest draft – embedded presentation-ready material • There are still open issues, which are rather poorly documented at present 13 14 Working Group(s) • XHTML 2 has been developed by the W3C's HTML WG GOALS AND PRINCIPLES • I am not on the WG, so I have limited inside information • XHTML 2 is being handed off to a new WG soon, according to the latest reports 15 16 Goals: ease of use Goals: universal access • Generic XML when possible • Better internationalization for the World • Less presentation, more structure Wide Web • Make the language easy to write • Device independence: – Author once, not once per device • Make the resulting documents easy to use – Render differently on different devices • Be as inclusive as possible (“design for our future selves”) 17 18 Goal: reduced use of scripting Breaking backward compatibility • Writing scripts is programming, not • Earlier versions of HTML were special- document authoring purpose languages • Only high-powered user agents (lots of • Backward compatibility required so that memory and CPU speed) can process scripts new documents would still be usable in • XHTML 2 tries to make declarative, not older browsers procedural, pages straightforward • Modern browsers can render arbitrary XML with stylesheets 19 20 Breaking backward compatibility Modular design • Much of XHTML 2 already works in existing • XHTML 2 is divided into modules which browsers together define the elements, attributes, • XML Events and XForms still require user and content models of the language agents that understand that functionality • Modules are meant to be reusable • Clever use of Javascript under the table can independently help here • If your XML design needs a bit of rich text, recycle some XHTML 2! 21 22 Namespaces Schema language independence • XHTML 2 introduces a new namespace • The working drafts define XHTML 2 syntax name: http://www.w3.org/2002/06/xhtml2/ normatively in RELAX NG (www.relaxng.org) . • Ruby, XForms, and XML Events have their • DTD and W3C XML Schema normative own namespace names definitions will be added in later drafts 23 24 Ubiquitous hyperlinks • Any element can be the target of a NEW AND NIFTY hyperlink (through the id attribute) • Any element can be the source of a hyperlink (through the href attribute) • The a element is kept for backward compatibility 25 26 Hyperlinking example Generalized transclusion • Any element can have a src attribute <p href=”#security”>Security providing external content to be rendered Considerations</p> instead of the element ... • This means rich text can be embedded as <p id=”security”>This system well as images and objects is just inherently insecure. • The img element is likewise kept for Deal with it.</p> backward compatibility 27 28 Transclusion example How to do images <img src=”...” alt=”text”> becomes <p src=”http://www.example.com/intro”> Hmm, transclusion isn't working. <span src=”...”>text</span> Sorry. <a or href=”http://www.example.com/intro”> Click</a> here and then use the Back <object data=”...”>text</object> button.</p> 29 30 External modules XForms • Ruby provides support for Japanese-style • Widgets can appear anywhere in a XHTML annotation document • XML Events is a greatly extended events • Arbitrary XML is embedded in the module based on DOM Level 2 Events document as a template • XForms is a completely new forms language • Widgets are bound using XPaths to • Other languages (MathML, SVG) aren't part appropriate parts of the template of XHTML 2 but can be used with it • The filled-out template is submitted 31 32 Streamlined language • HTML 4.0: 91 elements, 188 attributes (counting shared attributes only once) WHAT'S HISTORY • XHTML 2: 59 elements (plus 1 for XEvents and 29 for XForms), 59 attributes • Almost any attribute can be attached to almost any element • XHTML 2 is the true (refactored) second version of HTML 33 34 Presentational markup is It's XML, you know dead, dead, dead • Make sure all start-tags have end-tags and • Originally, HTML was designed to represent empty-tags end in /> the structure of a document, not its • Lower-case elements and attributes presentation • Quote attribute values • Presentation-oriented elements were later added to the language by browser • Wrap script and style content in CDATA manufacturers sections • XHTML 2 takes HTML back to its roots • HTML Tidy (tidy.sf.net) is your friend 35 36 Presentational markup is Presentational markup is dead, dead, dead dead, dead, dead • All presentational elements and attributes • Presentation handled solely by stylesheets are gone • Standardizing on stylesheets means • Even old warhorses like b, i, and br bite enhanced flexibility of presentation the dust • CSS can do more than presentational HTML • HTML Tidy is still your friend ever did • XSLT is also your friend • A standard stylesheet will be provided to give the default (traditional) presentation 37 38 The img and applet elements No more frames • Superseded by the new and generalized • Everything to do with frames is gone object element, which is now used to • The target attribute of hyperlinks embed any non-XHTML content remains, but its use is not defined • XSLT is your friend once again 39 40 New forms and event sublanguages • The new XForms language completely supersedes HTML Forms THE ELEMENTS • It's still possible for forms to return attribute-value pairs, but full XML documents are the recommended method • Event handling now uses XML Events 41 42 The Document Module The Structural Module • Elements: html , head , title , body • Elements: p, div , separator , address , • Attributes specific to the html element: blockquote , pre , blockcode , section , h, h1 -h6 – version replaces DOCTYPE declaration as an effective version signature • blockcode is a hybrid of blockquote – xsi:schemaLocation points to W3C and pre , intended to set off code XML Schemas for namespaces • separator replaces hr • p can now contain lists and tables, but not nested paragraphs 43 44 The section and h elements The Inline Text Module • section elements • Elements: abbr , cite , code , dfn , em , – contain major divisions of text kbd , l, q, samp , span , strong , sub , – can be nested to convey subdivisions, sub- sup , var subdivisions, etc. • No presentation elements: not even b and i • The h element works like h1 within a main survive document, like h2 within a top-level • q is for quotations, but no longer tries to section, like h3 within a sub-section, etc. supply quotation marks automatically (the • h1 -h6 are no longer necessary rules depend on language and country) 45 46 What are those elements for, The l element anyhow? • Container for a single line (of verse, • abbr : an abbreviation ( full attribute is an computer code, etc.) IDREF to the full name) • Replaces HTML's br • cite : a citation or source