XHTML2.0 new features preemptive preview _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
Tags xslt
Before the browser can process the next generation of XHTML, The XHTML2 specification has not yet been completed, but it has many advantages over XHTML1, these include richer structural features, which makes XHTML2 a better central mode for a single resource publishing system than its predecessor as an editing format. Before executing a large or small release, make a profit from this richer content structure before the browser can process the next generation of XHTML. The XHTML 2 Specification has not yet been completed, but it has many advantages over XHTML 1, these include richer structural features, which make XHTML 2 A Better central mode for a single resource publishing system than its predecessor as an editing format. Execute large or small releases
Make a profit from this richer content structure before the browser can process the next generation of XHTML.
The XHTML 2 Specification has not been completed yet, but it has many advantages over XHTML 1, including richer structure features, this allows XHTML 2 to act as a central mode for a single resource publishing system better than its predecessor as an editing format. People who execute large or small releases can now use the new features of XHTML 2 without waiting for the browser to provide support for its new user interface features.
About a year ago, an industry standards team asked me about the potential use of XHTML2 for publishers. I don't know if it is practical, but they are willing to pay for New York, so I decided to investigate it.
I do not need to make any effort in my investigation. XHTML 2 adds a richer structure on the basis of XHTML to make it a format that can be used to create and store content, rather than simply passing the content to the browser. When I say that XHTML 2 is already in use, I'm a little exaggerating. Many shops have very wise policies for this unfinished standard, XHTML 2 is still in the Working Draft stage (for more information, see references ). Unlike almost all HTML-related standards, XHTML 2 provides a lot of value before a well-known browser provides support for it, because, it is more likely to store content in richer and more complex structures, rather than deviating from familiar HTML elements and attributes. XHTML status quo: Where are we going?
W3C XHTML 1.0 standard creates an XML version of HTML. When the browser does not pay too much attention to whether the Web page is in a well-formatted XML format, Web site designers are tired of using one method for Firefox and using another method for Microsoft Internet Explorer, they see more value in standards. The style sheets of many Open-Source CSS collections (such as Open Web Design and Open Source Web Design) use the XHTML 1 sample file for demonstration purposes, I have heard that some Web designers who almost don't know what the format is, are proud to claim that their site is made up of XHTML. As Internet Explorer and Firefox support more and more CSS features, these Web designers add more design skills to the CSS style sheet to make it simpler and more direct (and easier to reuse) in the basic document.
XHTML 1.1 (see references) does not add new features, but divides XHTML into modules. Its value is manifested in two aspects. First, if we find that some modules have value while other modules have no value, we can use a subset of them more conveniently. For example, Wireless Application Forum (WAP) has a reason to merge the basic XHTML structure into its standard to deliver content to mobile phones, however, it does not want to allow WAP documents to merge some user interface features, such as image ing or editing module functions that are not very useful in small screens of mobile phones.
Another advantage of a modular architecture for a DTD or model is that it is easier to insert new modules proprietary to your applications. Combined with the function of selecting existing modules, this feature brings benefits to the publishing industry: the PRISM standard team devoted to publishing industry metadata selects a subset of XHTML 1.1, then we added some new modules with industry-specific vocabulary to facilitate content tracking by publishing workflows. (For more information about PRISM, see references .)
You can compare the development of XHTML 1.1 to cleanup the basement: You may not have to throw too many things, and you can use existing items more conveniently through better organization, you can even free up space to build a workbench and create new things on it.
Since May 2001, XHTML 1.1 has become a standard (or, according to W3C, a recommendation standard ). The latest development in XHTML 2.0 is a new Working Draft (Working Draft) released in July 2006 ). Although its final formation must go through several stages, you can use the relax ng mode (see references for this link) so that we can now create and use the XHTML 2 documentation, this allows you to quickly jump to XHTML when the specification becomes a recommendation standard. A simple XSLT style sheet converts these files to XHTML 1 for display by the browser, or you can use the XHTML 2 Working Draft file that currently contains (see references) the CSS style sheet of is displayed in the browser (for the moment, Firefox should be better. XHTML 2: What are the new features?
XHTML 2 retains the function of clearing existing syntaxes in XHTML 1 to make it more concise, and adds some new features. It has added support for XForms, which is a more complete successor to forms and has been applied in HTML for more than 10 years. XML Events are also included in XHTML 2, which allows us to identify Events triggered by some user interface operations, thus reducing the need to write scripts using JavaScript or ASP. These features will be interesting, especially when the main browser provides support for them, but other features will be even more interesting for the publisher even before the browser supports XHTML: a richer and more reusable structure with better device independence, easier access, improved semantics, and easier metadata Addition
# P # Richer Structure
Many publishers who need to store content in XML know that it is better to use the existing standard mode (W3C Schema, relax ng mode, or DTD) than to create one from scratch. After reading DocBook, they found it too complicated. After reading HTML or XHTML 1, they found it too simple. For many publishers, XHTML 2 well balances the richness of DocBook and the simplicity of XHTML 1, making it an excellent format for storing content, whether or not the content needs to be converted to another format for transmission in various media.
Listing 1 contains an example XHTML 1 file and shows the structure of the file in indent format.
Listing 1. Structure of the XHTML 1 file


My Web page


My Web Page

Here is my Web page.


Section 1 of my Web page

Here is section 1 my Web page.


Section 1.1 of my Web page

Here is a subsection of my Web page.


Section 2 of my Web page

Here is section 2 of my Web page.




We can see that the body element does not have much indent format, because the element does not have many structures. The tree structure of this document shows a body element with many child elements without grandchildren, the section "Here is a subsection of my Web page" will be displayed as a sibling element of the main h1 title "My Web Page. Only one part indicates that this section is part of a sub-section: the most recent topic, h3, is greater than the number of the previous topic. The container element does not combine any header as the title with its content unless the body element encapsulates the h1 header and other displayed content on the Web page. We can use a p element to encapsulate the combination of each header/content (header/content), but the p element is a quite common grouping element like the span element. It can be used for many purposes. For example, it instructs certain paragraphs to form a menu, a sidebar, or another visual representation element in a Web page. Therefore, we cannot assume that it represents a structural unit that indicates the content.
Combining the new section and h elements in XHTML 2 enables us to create a richer structure, making the content easier to reuse. Listing 2 demonstrates the XHTML 2 body element equivalent to the body element in Listing 1.
Listing 2. XHTML 2 body Element


My Web Page

Here is my Web page.



Section 1 of my Web page

Here is section 1 my Web page.



Section 1.1 of my Web page

Here is a subsection of my Web page.





Section 2 of my Web page

Here is section 2 of my Web page.





In this version of code, the "Here is a subsection" section is the Zeng sun element of the first section element, the "My Web Page" h element in this section shows its main title-it should be like this!
One of the advantages of this rich structure (which is also a key reason why XHTML 2 is more suitable for serving as the central format of a single-source distribution system than XHTML 1) is that it is easier to perform stream processing. If you need to process a large amount of input and cannot load the input into the memory before processing-for example, if you want to prepare content for the CD-ROM-processing makes it easier to calculate where each sectiong element ends in the XHTML 2 document. For example, suppose we want to call up all parts of the title containing the word "Beagle. It is easy to find these titles, but it is not difficult to determine where the section ends in XHTML 1. Whether or not stream-based interfaces, Xquery or XSLT are used for processing XHTML. Clearly defining the end position of a section can simplify the extraction.
Now, imagine you extract these sections because you will add them to the new release of beagle, and each section that is called up has an h3 element as its header. XHTML 1 headers marked with numbers, such as h3, are still valid in XHTML 2, but if new releases use these elements as the main section in a special section, or what will happen to the subsection? You need to go back and modify the h3 element to the h2 or h4 element, or any element that can recognize your role in the new context. If they are h elements of XHTML 2 in the original document, the numbers of each section ancestor element indicate their role levels (for example, the section 1.1 h element in Listing 2 has three section header ancestor elements, and the "My Web Page" h element only has one), so you can insert them into a new document without modification, the section elements of the new document are nested to indicate their roles. CSS, XSLT, and other XML processing tools and standards all provide a way to process elements of the same name based on nested hierarchies, so we will not miss the number as part of the header of XHTML 1. When we consider the number of (X) HTML documents with h2 and h3 elements but no h1 elements, or h1 and h3 elements but no h2 elements, it is obvious that too many people will not use them to indicate the appropriate level.
In XHTML 2, the p element can have more structures. I want to introduce the sample code in some statements, such as the following:
Print "Hello? World? ";
If I want to continue the statement after the sample code, XHTML 1 will force me to divide the statement into two parts in two different p elements, however, in terms of semantics, they are in the same statement. XHTML 2 allows us to place sample code, unordered list, numbered list, and many other block elements in a p element, so that our markup can more accurately reflect the structure of the document.
It takes a small step from representation marking to structural marking to rename the hr element as a separator. The HTML Working Group found that its original name (horizontal rule) often falls into the gray area between the structural tag and the representation tag. They received vertical rule requests from users using the language of Asian countries, and they saw that many horizontal splitters are not really rules (Steven Pemberton, Chair of the HTML Team, made a statement, it indicates several different variants of James Joyce's Ulysses. For more information, see references for links to this statement ). This allows them to rename the hr element to more accurately return the name they use and allow more flexibility in the statement.
# P # Better device independence, easier access, and more complete Semantics
These three goals actually overlap each other. For Web pages that can be easily understood by users who do not need to pass on a platform or whose eyesight is impaired, the text speech translator reads the content on the Web page. As mentioned in the XHTML 2 Working Draft:
Various new devices appear on the network, such as phones, PDAs, wordboards, TVs, etc. This means there is a design that allows us to create one and then present it in different ways on different devices, instead of creating a new version of the document for each type of device.
Publishers do not need to consider their value in the future. Devices independently make many of them apply to SGML before XML invention, because it makes these devices print the same content on Web pages and on CD-ROM, as long as there is sufficient structure and semantic information in the edited version of the content, the automatic routine converts it to its own format. I remember eleven years ago when our competitors wanted to save the edited content as HTML, my former boss's office was full of laughter; using XHTML 2 is no longer a crazy idea.
If the existing semantics in the XHTML 2 element is not enough for you, the newly added role attribute (which can be added to any element) can tell you more usage of the element. The XHTML 2 Specification specifies nine possible values for this attribute: banner, note, contentinfo, search, definition, secondary, main, seealso, and navigation. Role values, such as banner and navigation, are obviously more expressive. However, for values such as definition and note, the semantics is more practical in the publishing environment for multimedia content preparation. You can even construct your own role values as long as they are in your own namespace. Easier to add metadata
The W3C RDF standard allows us to assign metadata to any content that can be identified using URLs. The standard RDF/XML syntax for this operation appeared in 1999, and its complexity and difficulty have left many people away. By using existing HTML attributes and adding new attributes, XHTML 2 allows us to add metadata about documents and document components using the new and simpler RDFa syntax (you can use an about attribute to identify them ). In some examples in listing 3, the span element stores additional information required to embed the triple structure of the subject and the object (it may be easier to use the triple structure of the Object ID-attribute name-attribute value ), used to represent the RDF metadata.
Listing 3. Using span elements to encode metadata




Carrion, My Wayward Son


May 15,200 7





Because the RDFa tag in listing 3 does not use any about attribute to name the subject, the RDFa processor assumes that the document itself is the subject of each triple structure, this is exactly what we want-they are metadata about the document itself.
Assuming that the prefix dc Declaration represents Dublin Core namespace https://www.php1.cn/,fb represents the https://www.php1.cn/namespace of the virtual FooBar Company, the RDFa tag in listing 3 enables us to extract and load the following statement in the database of the RDF triples: this document has a Dublin Core subject "recipe ". The workflowStage value of this document (the custom metadata of the company that created this document) is "3a ". Dublin Core in this document is titled Carrion, My Wayward Son ". For this statement, the metadata value or the object of the triple is part of the current Web page and is not stored in the content attribute like other span elements. You do not need to specify a separate object and let the document itself act as the subject. We add a practical triple metadata in the document, where the span element has only one attribute. This document was issued on July 15, May 15, 2007. The actual storage value is 8601-05-15 in ISO 2007 standard format. It even contains the input information: the W3C Schema date data type.
The dream of Semantic Web is to allow Web page data to be published as content for people to read and as data for programmers to read, starting from the database, for example, the example of dc: title demonstrated in listing 3. The fb: workflowStage example demonstrates another advantage of RDFa: we can actually add any metadata to the XHTML 2 document for your own store, this makes the document easier to trace and reuse. Use XHTML 2 now
We still need to wait for a while before using the newer user interface features in XHTML 2 m, such as XML events ), however, we can now experiment with the new structure features in XHTML 2. As an unfinished specification, XHTML 2 is still a target in progress, but its progress is slow. The pattern and CSS style sheet are currently available. We can try to use it and consider what benefits it may bring to our operations. In fact, I used it to write this article, using Emacs in nXML mode (see references) to drive context-sensitive XML editing in the RELAX NG mode of XHTML 2. Before I submit this article, I have used a simple XSLT style sheet to convert it to a format conforming to the developerWorks DTD. When XHTML 2 becomes the standard recommendation standard, I plan to make it run at full speed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.