Setting value of root node in repeat function on xforms

43 Views Asked by At

I have an xforms (xsltforms) form containing a repeated list on the TEI <placeName> element. The repeat works fine, as does initializing the data for the <placeName> attributes, but I can't find a way to change the value of <placeName> on initialization. I'm guessing this is because it is the root node in the repeat, but I don't see why I can't change the value.

<xf:trigger>
  <xf:label>New place name</xf:label>
    <xf:action ev:event="DOMActivate">
      <xf:insert ref="instance('place')/listPlace/place/placeName" at="index('repeat')" position="after"/>
        <xf:setvalue ref="instance('place')/listPlace/place/placeName[last()]">placename</xf:setvalue>
        <xf:setvalue ref="instance('place')/listPlace/place/placeName[last()]/@type"/>
        <xf:setvalue ref="instance('place')/listPlace/place/placeName[last()]/@lang"/>
  </xf:action>
</xf:trigger>  

Any ideas? Cheers Ralph

1

There are 1 best solutions below

0
Ralph Corrigan On

It turns out my issue here was not with the initializing per se but with the display and update: the field to use for the root node of the repeat needed to be the '.' self node only and not either the node name or the Xpath. Not sure why this is, but it does solve the problem.