The HTML namespace is specially handled when viewing XML using CSS. Elements from the HTML namespace are displayed as they appear in HTML. This allows you to access features that are not yet provided by CSS. Some examples of useful HTML elements to insert are: <TABLE> , <A> , <IMG> , <SCRIPT> and <STYLE> .
For example, you can add a link and logo to the following sample restaurant overview. First, you must declare the HTML namespace at the top of the document, and then use the HTML prefix for inline HTML elements. The HTML embedded in this way must be well-formed XML, so the <IMG> element needs a minimal end tag.
<story xmlns:HTML="http://www.w3.org/Profiles/XHTML-transitional"> ... <restaurant> <name>Red Apple Inn</name> <logo> <HTML:A href="javascript:alert('Visit the Red Apple Inn!')"> <HTML:IMG src="red-apple.gif" height="50" width="200"/> </HTML:A> </logo> ...
In Microsoft® Internet Explorer, the prefix must remain HTML or html in order for elements to be interpreted as HTML elements.
The <HTML:STYLE> block can be used to insert a CSS stylesheet in an XML document. This block will complement any style sheets that are indicated by instructions for processing style sheets. When there is no external stylesheet, instructions should still be given on how to process the stylesheet, indicating that the XML document should be displayed using the CSS stylesheet language, even if the href attribute is not specified.
The following example shows how the stylesheet review.css can be embedded in an XML document using the HTML namespace, the <HTML:STYLE> element, and the stylesheet processing instruction without the href attribute. HTML
<?xml version="1.0"?> <?xml-stylesheet type="text/css"?> <story xmlns:HTML="http://www.w3.org/Profiles/XHTML-transitional"> <HTML:STYLE> story { display: block; font-family: Arial, Helvetica, sans-serif; font-size: small; width: 30em; } restaurant { display: block; padding: 1.2em; font-size: x-small; margin-bottom: 1em; } ... </HTML:STYLE> <restaurant> ...