[Petal] [FEATURE-REQ] xml:space="preserve"

Jean-Michel Hiver jhiver at mkdoc.com
Fri Jan 24 13:13:01 GMT 2003


> Hi
> 
> For things in XHTML like <pre> and <textarea> Petal has some special
> code (AFAIK) to ensure that whitespace is preserved.

I think you're getting confused. Petal has some special code to handle
tags which MUST be self-closing when outputting XHTML rather than XML,
such as <br />.

It just happens that neither XML::Parser nor HTML::TreeBuilder trim
whitespaces. And guess what, there's nothing Petal could do if they
did... apart from using its own parser that i'd have to write...


> I think it would be a good idea if this was extended to include support
> for the xml:space="preserve" attribute [1].

That's up to whichever parser Petal is using.


> In fact I personally wouldn't mind if we had to use xml:space="preserve"
> in XHTML before whitespace was preserved on <pre> and other elements.

You can do it if you think it's good practice, however at the moment
Petal will treat it as any other piece of XML.

Petal preserving whitespace whatever happens is I think the right
behavior for a templating system. Hence I don't think petal needs to
worry about the xml:space attribute.

And if Petal ever needed to worry about that kind of stuff, it should be
in the Petal namespace, not in the XML namespace. i.e.
petal:whitespace="preserve".

Which makes me think that maybe we want a petal:self-close="false|true"
directive for tags which need to be self-closed? Would that be of any
use to anybody?

Cheers,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver at mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/



More information about the Petal mailing list