Fulfill XHTML compat requirements with XSLT output
Posted: Sat Sep 09, 2006 7:05 pm
Using this XSLT:
I've been outputting XHTML. This works fairly well, but there's one trouble: Empty elements are expressed like this: <br/>. Being the perfectionist I am, I know that for compatibility reasons they should be <br /> (note the extra space). I've searched high and low for the ability to do this and have been unable to find it, so I'm fudging it with:
...but I suspect this is less than ideal, especially if there's a CDATA section hanging out. Anyone know the answer, or is this fine as it is?
Code: Select all
<xsl:output
method = "xml"
encoding = "UTF-8"
doctype-public = "-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
indent = "yes"
media-type = "text/html"
/>Code: Select all
$html_output = str_replace('/>', ' />', $html_output); // empty element " />"