Subject: RE: [xsl] Closing element required instead of self closing From: "Scott Trenda" <Scott.Trenda@xxxxxxxx> Date: Tue, 15 Jul 2008 13:37:36 -0500 |
I'm anticipating the flames already, but there is one more (painful!) kludge available. If you have the flexibility (via exsl:node-set or a separate transformation) to use <xsl:output method="text"/> for your final transformation, you _can_ cobble together an adequately accurate X(HT)ML-as-text parsing stylesheet in XSLT 1.0. I've put together a similar HTML-as-text stylesheet before, based on the HTML serialization rules in the spec, and I seem to remember it working on par with the native processor's HTML serialization. I would think that a similar XHTML-to-text stylesheet would give you the fine-grained control over closed/open empty tags where you need it, while keeping the actual content's data straightforward. Let me know if you want the HTML-as-text stylesheet (direct reply). For the record, I was making the HTML-as-text stylesheet as a part of a larger translation stylesheet for our almost-XML preprocessor language at work, where it'd be really handy to be able to generate and manipulate a close XML dialect and do one mass conversion when it's needed as text. I'm not a masochist, I swear. :) And for the purists, I stress that this is a hack and I acknowledge it as one, but it _does_ work. From what I remember, IE handles the output text identically to the same output HTML from the processor. ~ Scott -----Original Message----- From: Michael Kay [mailto:mike@xxxxxxxxxxxx] Sent: Tuesday, July 15, 2008 11:27 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Closing element required instead of self closing > > In the real world, many people try to deliver a standards > based website using XSLT - they choose strict XHTML but are > quite often limited to XSLT 1.0 and it's XML output method, > so all of the various hacks are needed. It really wouldn't > have been such a big deal if a processor offered a > tag-minimization="no" serialization option.... But suppressing all tag minimization is not enough. In fact, rendering <hr/> as <hr></hr> is absolutely the wrong thing to do. If you're going to provide extensions to an XSLT 1.0 serializer to handle the XHTML requirement, you might as well do it properly (as Saxon did) and provide an output="xhtml" method. Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Closing element required , Michael Kay | Thread | RE: [xsl] Closing element required , V.Ramkumar |
RE: [xsl] Closing element required , Michael Kay | Date | Re: [xsl] Printing CDATA from feed , Joelle Tegwen |
Month |