Re: [Xsltforms-support] applying a stylesheet in an instance to data in an instance
Brought to you by:
alain-couthures
From: Alain C. <ala...@ag...> - 2012-07-18 20:03:17
|
Le 18/07/2012 00:03, C. M. Sperberg-McQueen a écrit : > 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. > I have fixed this now. It was due to metadata (model id, instance id) stored in extra attributes (xsltforms_*) being erased. Thank you for your feedbacks! -Alain |