[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] XSLT for usable yet valid XHTML
Subject: Re: [xsl] XSLT for usable yet valid XHTML From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 6 Apr 2005 16:23:12 +0100 |
> which, while valid XHTML, is viewed as an open tag without > closure by practically all current web browsers. actually most current browsers (IE, mozilla, opera, etc) can, and will, correctly parse XHTML (and any XML) If it is served with an XML mime type rather than an html one. IE (but not the others) then needs a client side stylesheet to style the xhtml but this can be a single template <xsl:template match="/"><xsl:copy-of select="/"/></xsl;template> mozilla etc don't need this and have native rendering of xhtml. Howver there are reasons for still using text/html (and so relying on the non existant error reporting to let XML syntax slip past an HTML parser) several possibilities: a) use xslt2 (saxon 8) which has an xhtml output method specifically to address this issue. b) post process with (eg) tidy to produce "cleaned up and browser safe" xhtml. c) I have a stylesheet I wrote for the MathML specification that takes as input an html producing stylesheet and generates an xhtml producing one, making sure that block level elements like p are never empty, and making sure that empty elements like br have at least one attribute so that you get <br class="jhgf"/> not <br/>. It's available in the MathML spec source distribution at http://www.w3.org/TR/2003/REC-MathML2-20031021/mathml-source.zip I suppose I should put it somewhere else as well. d) I did (c) but if I was doing it now I would probably write a stylesheet that took as input the output of the xml method and just did the same changes as in (c) but on teh document itself rather than to the stylesheet. that's probably simpler, just templates like <xsl:template match="h:p[not(node())]"><p><xsl:text> </xsl:text></p></xsl:template> David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT for usable yet valid, Robert Koberg | Thread | Re: [xsl] XSLT for usable yet valid, Robert Koberg |
RE: [xsl] XSLT for usable yet valid, Jonah Gold | Date | RE: [xsl] XSLT for usable yet valid, Kevin Rodgers |
Month |