Dependencies for XPath evaluation

John,

An xslt() function wouldn't be the only situation to be concerned with 
ancestor dependencies.

Here is a very basic test case:

<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:ev="http://www.w3.org/2001/xml-events" 
xmlns:xf="http://www.w3.org/2002/xforms">
   <head>
        <title>Hello to the Bear Family</title>
        <xf:model id="mod">
         <xf:instance>
            <data xmlns="">
             <PersonGivenName>Teddy</PersonGivenName>
             <PersonName>Bear</PersonName>
            </data>
         </xf:instance>
        </xf:model>
   </head>
   <body>
        <xf:input ref="PersonGivenName" incremental="true">
            <xf:label>Please enter your first name: </xf:label>
        </xf:input>
        <br />
        <xf:output value=".">
            <xf:label>Hello </xf:label>
        </xf:output>
    </body>
</html>

As you can see, "Hello Teddy Bear" is expected and this should change to 
"Hello Ma Bear" when typing "Ma" instead of "Teddy".

I tested it against Mozilla Extension, Formula EMC and XSLTForms. 
Formula EMC is the only one succeeding but I don't know if Simon has 
implemented a dependency engine ;-)

What do you think?

Thanks!

-Alain

COUTHURES Alain a écrit :
> John,
>
> Well, at least for XSLTForms, there is an appreciable difference in 
> speed because, with an action, the text result has to be parsed and 
> stored in specific DOM-like objects then serialized in Javascript. 
> It's also much easier for developers not to have to write actions on 
> events.
>
> Wouldn't it be more interesting to consider dependencies with 
> ancestors: if a node has changed, all its ancestors have too??
>
> Thanks!
>
> -Alain
>
> John Boyer a écrit :
>>
>> Hi Alain,
>>
>> Agreed the ability to call the transform as a function is 
>> syntactically easier.  Not sure why there is any appreciable 
>> difference in speed.
>>
>> Regarding dependencies, though, yes I think you are missing where the 
>> dependencies are coming from.
>> The output of the xslt might be a string, but the input to be 
>> transformed would be the *root* of some data node.  The function 
>> implicitly consumes all nodes in the subtree, but the parameter 
>> refers only to the root node, so the XPath containing xslt() would 
>> not have any dependencies on all the nodes.
>>
>> If you call the xslt() function someplace that is ephemeral, like a 
>> submission ref, then it's OK because the result is obtained at a 
>> point in time, used and then discarded.  There is no long term 
>> tracking of dependencies on the XPath.  But an XPath in a UI binding, 
>> for example, is different.  The XForms processor is expected to make 
>> the UI reflect the state of the model.  So any change within the 
>> entire data subtree should reasonably cause your <xf:output 
>> value="xslt(data/root)"/> to be updated by running the transform 
>> again.  And when that doesn't happen, it looks like a language defect.
>>
>> Cheers,
>> John M. Boyer, Ph.D.
>> STSM, Lotus Forms
>> Workplace, Portal and Collaboration Software
>> IBM Victoria Software Lab
>> E-Mail: boyerj@ca.ibm.com  
>>
>> Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
>> Blog RSS feed: 
>> http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw

Received on Saturday, 24 April 2010 08:00:33 UTC