|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSLT for usable yet valid XHTML
> 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 ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








