[lxml-dev] Overriding whitespace normalization under XSLT

Stefan Behnel stefan_ml at behnel.de
Wed Mar 21 09:13:42 CET 2007



Nathan R. Yergler schrieb:
> Thanks to everyone for their suggestions.  Sounds like there's not
> some secret knob to turn (or at least not one that the group knows
> about).  I did find that passing the result through tidy formats it
> correctly, so that's the interim fix for me.

The suggestion by Lee Brown could be implemented by canonicalising
(c14n_write) the XML output, in case you want to drop a dependency here.

Stefan


> On 3/17/07, Lee Brown <leebrown at leebrown.org> wrote:
>> Greetings!
>>
>> With regards to the snippet below, the "missing" space is valid XHTML but
>> not valid HTML according specifications preceding HTML 4.01.
>> Provided that it won't break your consumer's browser agents, setting the
>> DOCTYPE to HTML 4.01 Strict or to XHTML 1.0 Strict and omitting the
>> leading
>> XML declaration should cause this to render correctly in most modern
>> browsers.
>>
>> If you must support older browsers, try adding a closing </img> tag.
>> Technically, that's invalid HTML as well, but most of the older browsers
>> will parse it anyway.
>>
>> Best Regards,
>> Lee E. Brown
>> (leebrown at leebrown.org)
>>
>> -----Original Message-----
>> From: lxml-dev-bounces at codespeak.net
>> [mailto:lxml-dev-bounces at codespeak.net]
>> On Behalf Of Stefan Behnel
>> Sent: Saturday, March 17, 2007 1:33 AM
>> To: Nathan R. Yergler
>> Cc: lxml-dev at codespeak.net
>> Subject: Re: [lxml-dev] Overriding whitespace normalization under XSLT
>>
>> Nathan R. Yergler wrote:
>> > The part that's problematic is this line:
>> >
>> >               <a rel="license" href="{$license-uri}"><img alt="Creative
>> Commons
>> > License" style="border-width:0" src="{$license-button}" /></a><br/>
>> >
>> > Note that there is a space between the closing quote of the src
>> > attribute on the image tag and the "/>" closing bracket.  When we
>> > process the transform, we consistently end up with
>> >
>> >               <a rel="license" href="..."><img alt="Creative Commons
>> License"
>> > style="border-width:0" src="..."/></a><br/>
>> >
>> > (note the space has been removed)
>>
>> That's perfectly well-formed XHTML. But rumour has it that some browsers
>> can't handle that. It's just not old-style HTML-ish enough.
>>
>> Stefan
>> _______________________________________________
>> lxml-dev mailing list
>> lxml-dev at codespeak.net
>> http://codespeak.net/mailman/listinfo/lxml-dev
>>
>>


More information about the lxml-dev mailing list