Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT Output - Well Formed HTML?? 1

Status
Not open for further replies.

webtank

Programmer
Dec 10, 2002
3
0
0
GB
I am performing XSLT transformations on templates that are built using well-formed HTML i.e. all tags are closed like this <br/>

The transformation works fine, but the HTML output generated seems to have removed the closing tags from my <br/> nodes (making them <br>), and now the output is not well formed.

This means I cannot add the resulting HTML data to a further XML message without having to use a (really rough) routine to run through adding all of the closing tags back in again!

Am I missing something?

Cheers,
Webtank.
 
If you want to generate HTML that is also XML, then what you want to generate is XHTML. If this is the case, make sure the method attribute for the <xsl:eek:utput> is &quot;xml&quot;, and have the appropriate doctype. For example, your stylesheet could begin like this:

Code:
<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
<xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform&quot;>[/URL]
	<xsl:output method=&quot;xml&quot; indent=&quot;yes&quot; cdata-section-elements=&quot;script style&quot; doctype-public=&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;/>

For more info on XHTML, see
 
That worked a treat, thank you very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top