Re: [Xsltforms-support] Experimental Component control (Was: A couple of questions about subforms)
Brought to you by:
alain-couthures
From: Eric v. d. V. <vd...@dy...> - 2013-06-05 21:19:45
|
Alain, That's clearer, thanks for these explanations! I have a first bug report for these new features ;) ... If you replace the repeats by groups that's no longer working: <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> <xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"> <xh:head> <xh:title>Figures</xh:title> <xf:model> <xf:instance id="main"> <figures> <rectangle height="10in" width="4em"/> <circle radius="8%"/> </figures> </xf:instance> </xf:model> </xh:head> <xh:body> <xf:group ref="rectangle"> <xf:output value="name()"/> <ul> <xf:group ref="@height"> <li> <xf:component ref="." resource="size.xml"/> <xf:output value="concat(' = ',.)"/> </li> </xf:group> <xf:group ref="@width"> <li> <xf:component ref="." resource="size.xml"/> <xf:output value="concat(' = ',.)"/> </li> </xf:group> </ul> </xf:group> </xh:body> </xh:html> The values which are displayed by the component in its input fields are now the initial values that are in the subform! Thanks, Eric Le mercredi 05 juin 2013 à 22:46 +0200, Alain Couthures a écrit : > Eric, > >> Currently, the default instance of a subform is merged with the one > >> in the main form while, from a component, it has its own id. That's > >> why those functions don't work with subforms even if their name would > >> say so ... ;-) > > That's what I had guessed but can you elaborate on this instance merge? > For subforms, models already with the same ids in the main form are > merged: instances are merged and bindings are added in the main form. > Merging instances is similar: if the corresponding id already exists in > the main form, it is ignored; if not, it is added. > > The default model without an id and the default instance without an id > are merged as if they had the same id. > > > > I had the feeling that the context node in the master form was becoming > > the instance of the subform, is that what you mean? > No, in a subform, instances are identical but scoping is effective and > "." references the context node. > > > > Couldn't subform-instance() and subform-context() be pointers to the > > subform default instance and context node without changing the behaviour > > of this "merge"? > Yes, that's possible but I would say that subform-instance() should be > useless unless, depending on the different situations, a component would > also be used as a subform. > >> XSLTForms is a versatile product which can very easily be extended at > >> any level (I know I'm not the only one doing this...)! > > Sounds impressive... > > > > > Well, XSLT is powerful and Javascript can now do a lot of things! > > -Alain > |