My logic was that putting "%s %s" is a valid string, and there shouldn't be any gotchas there - putting a "%s" into a String() doesn't do anything by itself. That the format attribute invokes processing on a normal string is natural to me and if you forget, you get "%s" on your screen to remind you :)

As to the name of the function colliding, id' rather see the (lesser used, i presume, is the opinion?) format() function named to 'applyFormat' to mimic applying a delegate, and allowing both to be easily remembered.

Any better? Think this is my best here, otherwise overall i still like #2 the best , strange though that sound.

in tag land

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

and in javascript:

<text datapath="person/"
ondata="applyFormat('%s %s', datapath.xpathQuery('firstName/ text()'), datapath.xpathQuery('lastName/text()'))"
    />

(which blows away the current contents of the text attribute by nature, of course)

-j


On Jul 11, 2007, at 3:59 PM, P T Withington wrote:

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

On 7/11/07, James Robey <[EMAIL PROTECTED]> 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?



Reply via email to