Dealing with HTML Elements That Are Not Well Formed

The difference between this and the style sheets you have encountered so far is in the <xsl:output method="html"> element. When instructed to output HTML, an XSLT engine will allow the outputting of HTML that is not well-formed XML, such as <IMG> tags.

The most important difference between HTML output and XML output is that empty elements do not have closing tags. In XML, an <img> element might be written like this:

<img src=”foo.gif” /> 

or

<img src=”foo.gif”></img> 

Whereas in HTML mode, the following is output:

<img src=”foo.gif”> 

The elements <AREA>, <BASE>, <BASEFONT>, <BR>, <COL>, <HR>, <IMG>, <ISINDEX>, <LINK>, <META>, and <PARAM> are empty in HTML 4.0. Because HTML is not case sensitive, ...

Get Special Edition Using XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.