1 / 17

Semantic markup

Semantic markup. Library and Information Services University of St Andrews. 1. XHTML. a reformulation of HTML 4 in XML 1.0 Specification: http://www.w3.org/TR/xhtml1/. Some differences to HTML 4. Documents must be well-formed

bazyli
Download Presentation

Semantic markup

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Semantic markup Library and Information Services University of St Andrews

  2. 1. XHTML • a reformulation of HTML 4 in XML 1.0 • Specification: http://www.w3.org/TR/xhtml1/

  3. Some differences to HTML 4 • Documents must be well-formed • Correct: <p>here is an emphasized <em>paragraph</em>.</p> • Incorrect: <p>here is an emphasized <em> paragraph.</p></em>

  4. Element and attribute names must be in lower case • XHTML is case sensitive-> <h1> and <H1> are different tags

  5. For non-empty elements, end tags are required • Correct:<p>This is the first paragraph.</p><p>This is the second paragraph.</p> • Incorrect:<p> This is the first paragraph.<p> This is the second paragraph.

  6. Attribute values must always be quoted • Correct: <td rowspan=“3”> • Incorrect: <td rowspan=3>

  7. Empty elements • Correct: <br />, <hr />, … • Incorrect: <br>, <hr>, …

  8. The elements with 'id' and 'name' attributes • HTML 4: • “name” attribute for a, applet, form, frame, iframe, img, and map • Introduction of “id” attribute • XHTML 1.0: • “name” attribute is deprecated and will be removed in subsequent versions

  9. Versions of XHTML • XHTML 1.0 Frameset • For web sites using frames • XHTML 1.0 Transitional • Takes advantage of XHTML features but ensures backwards compatibility • XHTML 1.0. Strict • Ensures clean structural markup free from markup associated with layout • XHMTL 1.1. (strict only) • In preparation XHTML 2.0

  10. Document Type Definitions (DTD) • XHTML 1.0 Strict<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> • XHTML 1.0 Transitional<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> • HTML 3.02<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.02 Final//EN”>

  11. XML namespaces • register a unique identifier for a particular XML vocabulary • provide a means of differentiation between tags from different XML vocabularies that happen to share the same name • The XHTML namespace<html xmlns="http://www.w3.org/1999/xhtml">

  12. 2. Semantic markup • Markup that is meaningful to the context of the document and its purpose <poem> <title>At Lulworth Cove a Century Back</title> <stanza> <line>HAD I but lived a hundred years ago</line> <line>I might have gone, as I have gone this year,</line> <line>By Warmwell Cross on to a Cove I know,</line> <line>And Time have placed his finger on me there:</line> </stanza> <!-- more stanzas --> </poem>

  13. Example: XML <bibliography> <item> <author> <firstname>Thomas</firstname> <name>Hardy</name></author> <title>Far from the Madding Crowd</title> <place>London</place> <publisher>Smith, Elder & Co.</publisher> <year>1874</year> <category>Fiction</category> <description>2 vols.</description> </item> <!-- more items --> </bibliography>

  14. Example: XHTML <div id=“bibliography”> <p id=“item”> <span class=“author”> <span class=“firstname”>Thomas</span> <span class=“name”>Hardy</span>.</span> <span class=“title”>Far from the Madding Crowd</span>. <span class=“place”>London</span>: <span class=“publisher”>Smith, Elder & Co.</span>, <span class=“year”>1874</span>. <span class=“category”>Fiction</span> (<span class=“description”>2 vols.</span>) </p> <!-- more items --> </div>

  15. Cascading Style SheetsPart 2 Library and Information Services University of St Andrews

  16. What’s next? • Convert the file wb.html into XHTML. • Develop a markup that is similar to that in the example given in the presentation and a corresponding style sheet. • Open the file wessex.html and develop your own semantic markup (e.g. real names, names of fictional characters, titles of Hardy’s works, real places, fictional places, etc.) and style sheet.

More Related