Re: [Xsltforms-support] Context() in insert with origin.
Brought to you by:
alain-couthures
From: <ala...@ag...> - 2015-04-08 06:26:18
|
Hi Mark, This behavior is conform to W3C Specifications: the context attribute redefines the current context for other attributes. If you want to clone the selected item at the end of the repeat, please have a look at this 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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <head> <title>Repeat Select1</title> <xf:model> <xf:instance xmlns=""> <items> <item> <date xsi:type="xsd:date">2015-04-01</date> <status>A</status> </item> <item> <date xsi:type="xsd:date">2015-04-02</date> <status>A</status> </item> </items> </xf:instance> </xf:model> </head> <body> <xf:repeat id="repeat-id" ref="item"> <xf:output ref="date"> <xf:label>Date: </xf:label> </xf:output> <span>   </span> <xf:select1 ref="status"> <xf:label>Status: </xf:label> <xf:item> <xf:label>A</xf:label> <xf:value>A</xf:value> </xf:item> <xf:item> <xf:label>B</xf:label> <xf:value>B</xf:value> </xf:item> <xf:action ev:event="xforms-value-changed"> <xf:message><xf:output value="index('repeat-id')"/></xf:message> <xf:insert ref="../../item" position="after" origin=".."/> </xf:action> </xf:select1> </xf:repeat> </body> </html> Thank you for your feedback! --Alain > Le 7 avril 2015 à 00:54, Mark Lawson <tin...@gm...> a écrit : > > Hi, > > I'm using an insert inside an action that's inside an xf:repeat. What it's > meant to do is insert a new copy of the current node as a sibling. like so: > > <xf:action ev:event="xforms-value-changed"> > <xf:insert context="context()/.." at="last()" position="after" > origin="context()" /> > The problem is that context() returns the node I'm currently working with in > all cases but when I use it in origin. In that case it's returning the parent > of the current node. > > The background to this is I'm logging control changes, and using insert as a > way to get event context to an observer, so ideally I need the origin of the > insert to be generic. > > Rgds, > > Mark Lawson > > > ------------------------------------------------------------------------------ > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT > Develop your own process in accordance with the BPMN 2 standard > Learn Process modeling best practices with Bonita BPM through live exercises > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ > > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF_______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > |