On Jul 17, 2012, at 3:17 PM, Alain Couthures wrote: > Rev. 550 includes a new experimental action named "setnode" with @inner or > @outer attributes to perform a "loadXML" for the corresponding node.
That looks great! Thank you very much. > > Here is a test case: > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events"> > <head> > <title>Inner & Outer Set Node</title> > <xf:model> > <xf:instance> > <data xmlns=""> > <item>a</item> > </data> > </xf:instance> > </xf:model> > </head> > <body> > <h1>Inner & Outer Set Node</h1> > <xf:output value="item"/> > <xf:trigger> > <xf:label>Inner</xf:label> > <xf:setnode ref="." ev:event="DOMActivate" > inner="'<item>b</item>'"/> > </xf:trigger> > <xf:trigger> > <xf:label>Outer</xf:label> > <xf:setnode ref="item" ev:event="DOMActivate" > outer="'<item>c</item>'"/> > </xf:trigger> > </body> > </html> This works fine. To try to make sure I understood the new action, however, I tried the following variation, which works as expected with one exception: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"> <head> <title>Inner & Outer Set Node</title> <xf:model> <xf:instance> <data xmlns=""> <item>a</item> </data> </xf:instance> </xf:model> </head> <body style="margin: 0.5em;"> <h1>Inner & Outer Set Node</h1> <p>The instance currently looks like this:</p> <pre> <xf:output value="serialize(.)" mediatype="text/plain"> </xf:output> </pre> <hr/> <p>These buttons apply the <code>setnode</code> action to the instance root (<code>.</code>):</p> <xf:trigger> <xf:label>Set Inner to '<item>b</item>'</xf:label> <xf:setnode ref="." ev:event="DOMActivate" inner="'<item>b</item>'"/> </xf:trigger> <xf:trigger> <xf:label>Set Outer to '<item>c</item>'</xf:label> <xf:setnode ref="." ev:event="DOMActivate" outer="'<item>c</item>'"/> </xf:trigger> <hr/> <p>These buttons apply the <code>setnode</code> action to the child of the instance root (<code>./item</code>):</p> <xf:trigger> <xf:label>Set Inner to '<item>d</item>'</xf:label> <xf:setnode ref="./item" ev:event="DOMActivate" inner="'<item>d</item>'"/> </xf:trigger> <xf:trigger> <xf:label>Set Outer to '<item>e</item>'</xf:label> <xf:setnode ref="./item" ev:event="DOMActivate" outer="'<item>e</item>'"/> </xf:trigger> </body> </html> The second button of the first pair attempts to supply an outer value for the outermost element of the instance (.) -- essentially, that is, it attempts to replace the instance entirely. The other buttons work as I expected, but this one doesn't seem to have the desired effect (and after I click it, the others stop working). My idea is that setnode ref="instance('x')" outer="..."/> should have essentially the same effect as <xf:submit target="bounce-xml-string-back-as-xml" replace="instance" instance="x" ref="y"/> when y is an XPath expression pointing to a node set whose serialization is the same string as given in the 'outer' attribute. If that's not possible from an implementation point of view, I can live with it. But I predict I won't be the last user who hopes it will work that way :) In any case, thank you again, this is great. -- **************************************************************** * C. M. Sperberg-McQueen, Black Mesa Technologies LLC * http://www.blackmesatech.com * http://cmsmcq.com/mib * http://balisage.net **************************************************************** ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Xsltforms-support mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xsltforms-support
