[Laszlo-user] [Laszlo-dev] Your vote needed: Text formatting and datapaths
Vandana Gunwani
vandana.gunwani at gmail.com
Sat Jul 14 09:18:19 PDT 2007
I vote for this:
<text datapath="person/" textformat="'%s %s'" data="$path{'firstName/
text()'}, $path{'lastName/text()'}" />
It would be great if this syntax can be used for other components also.
-Vandana
On 7/11/07, P T Withington <ptw at openlaszlo.org> wrote:
>
> I like that idea!
>
> Maybe instead of allowing multiple $path expressions, we should in
> general allow multiple data arguments:
>
> <text datapath="person/" textformat="'%s %s'" data="$path{'firstName/
> text()'}, $path{'lastName/text()'}" />
>
> Then you could say things like:
>
> <text
> textformat="You have %d items in your cart, for a total of $%6.2d"
> data="${cart.itemCount}, ${cart.total}"
> />
>
> On 2007-07-11, at 16:25 EDT, Vagelis Papadogiannakis wrote:
>
> > Hello everybody,
> >
> > Please consider changing dataformat to textformat as shown bellow.
> >
> > <text datapath="person/" textformat="'%s %s'" data=$path
> > {'firstName/text()', 'lastName/text()'} />
> >
> >
> > Vagelis
> >
> >
> >
> >
> > On 7/11/07, P T Withington <ptw at openlaszlo.org> wrote:
> >> 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?
> >>
> >>
> >>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-user/attachments/20070714/b12de3d7/attachment.html
More information about the Laszlo-user
mailing list