[Laszlo-user] [Laszlo-dev] Your vote needed: Text formatting and datapaths

P T Withington ptw at openlaszlo.org
Wed Jul 11 12:59:12 PDT 2007


On 2007-07-11, at 15:49 EDT, Henry Minsky wrote:

> On 7/11/07, James Robey <jrobey at laszlosystems.com> wrote:
>>
>> Wow, a major reduction in code size and removes lexically spurious  
>> layouts
>> too!
>>
>>
>> *If i were king*:
>> <text datapath="person/" text="%s %s" format="$path{'firstName/text 
>> ()',
>> 'lastName/text()'}" />
>>
>
> I vote for that one!

Problems:

1) `text` is the actual content of the text node.  You don't want the  
compiler to magically guess that if there are %'s in the content that  
it should do something different.

2) `format` is a method on text nodes.  We cause infinite pain when  
we try to have an attribute and a method with the same name.

This suggestion is really choice 3 (which uses new attribute names to  
avoid the problems above):

   <text datapath="person/" dataformat="'%s %s'" data=$path 
{'firstName/text()', 'lastName/text()'} />

(I showed `dataformat` as being an expression, so you could have a  
variable format if you liked.)

So, should I infer you and James really like choice 3?




More information about the Laszlo-user mailing list