[Petal] attributes question

Fergal Daly fergal at esatclear.ie
Sun Jul 27 16:19:56 BST 2003


On Sunday 27 July 2003 14:42, Chris Croome wrote:
> On Sun 27-Jul-2003 at 01:26:38PM +0100, Fergal Daly wrote:
> > 
> > <option name="aaa" value="bbb" selected>
> 
> That is valid HTML [1] but for XHTML [2] this syntax should be used:
> 
>   <option selected="selected>Foo</option> 
> 
> Chris

Fair enough but the point is that petal is incapable of generating

<tag attr="" />

or anything which is equivalent to that. It's possible that XHTML never 
requires attrs with empty values but there are uses for them, alt="" being 
one. Also, there are other XML doctypes where they are common, including 
anything that tries to represent program data structures like SOAP or 
XML-RPC. Also, it's quite possible that XHTML will introduce some, although 
it looks like they are actively avoiding that at the moment.

Given that

<tag attr="">

and

<tag>

have different meanings in XML, we should be able to generate both of them. 
The difference between them corresponds well with the difference between "" 
and undef in Perl. There are 2 XML concepts we need to represent and we have 
2 distinct Perl conepts that we can use to represent them so why not map them 
one to one?

Just personally, on the principle of least surprise, if my expression returns 
"" for an attr value, I would expect my XML to have attr="", not just 
disappear entirely,

F



More information about the Petal mailing list