Re: [xslt] avoid self-closing tags on ouptut?



On Fri, Oct 09, 2009 at 01:57:00PM +0100, Sam Liddicott wrote:
> Are there any options for libxslt to cause self-closing tags to be  
> emitted as a tag pair?
>
> I've been using libxml2's html parser so that I can process html  
> documents with xsltproc, but some tags emitted are invalid html; e.g.
>
> <tt></tt>
>
> after xslt processing becomes
>
> <tt/>

  if you're using XML as the output then 2 two have the *exact* same
semantic from an XML viewpoint.

> which firefox hates and won't fix; see:
>   https://bugzilla.mozilla.org/show_bug.cgi?id=521300
>
> Quoting: "We uphold this (and the W3C Markup Working Group
> agrees) so that people aren't tempted to try to throw XML constructs at  
> these old user agents."

  Then don't generate XML but HTML. And triple check the mime type
used in the HTTP headers.

> which I agree with, and where "XML constructs" seems to mean at least  
> self-closing tags.
>
> So although libxml2's html parsing of "tag soup" is a boon, unless I  
> want to present the output as text/xml (which I do not) I'm in trouble.
>
> I suppose could write some xslt to insert a comment in such empty nodes  
> so that they are no longer empty...
> <tt/> becomes <tt><!-- --></tt>

  I'm not sure I understand what that would solve !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]