Duplicate instance node to another instance

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Duplicate instance node to another instance

tayjack-2
I have two instance

<model>
  <instance id="instance-1">
    <options>
      <option>
        <id>1</id>
        <name>NAME 1</name>
      </option>
      <option>
        <id>2</id>
        <name>NAME 2</name>
      </option>
      <option>
        <id>3</id>
        <name>NAME 3</name>
      </option>
      <option>
        <id>4</id>
        <name>NAME 4</name>
      </option>
    </options>
  </instance>
  <instance id="instance-2">
    <items>
      <item>
        <options>
          <option>
            <id />
            <name />
          </option>
        </options>
      <item>
    </items>
  </instance>
</model>

I would like to copy instance-1 all option to instance-2 when particular
event activated, like this

  <instance id="instance-2">
    <items>
      <item>
        <options>
          <option>
            <id>1</id>
            <name>NAME 1</name>
          </option>
          <option>
            <id>2</id>
            <name>NAME 2</name>
          </option>
          <option>
            <id>3</id>
            <name>NAME 3</name>
          </option>
          <option>
            <id>4</id>
            <name>NAME 4</name>
          </option>
        </options>
      <item>
    </items>
  </instance>

How to accomplish it?

thanks in advance,

Jack




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Duplicate instance node to another instance

fl.schmitt(ops-users)
Jack,

> I would like to copy instance-1 all option to instance-2 when particular
> event activated, like this (...)
> How to accomplish it?

you will have to use xforms:insert / xforms:setvalue for every element
to copy - to iterate over the option elements, you could use xxform:iterate:

http://www.orbeon.com/ops/doc/reference-xforms-2#exforms-iterate

HTH
florian


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Duplicate instance node to another instance

Erik Bruchez
Administrator
>> I would like to copy instance-1 all option to instance-2 when  
>> particular
>> event activated, like this (...)
>> How to accomplish it?
>
> you will have to use xforms:insert / xforms:setvalue for every element
> to copy - to iterate over the option elements, you could use  
> xxform:iterate:
>
> http://www.orbeon.com/ops/doc/reference-xforms-2#exforms-iterate

Iterating may not be needed in this case:

<xforms:delete nodeset="instance('instance-2')/items/options/option"/>
<xforms:insert context="instance('instance-2')/items/options"  
origin="instance('instance-1')/option"/>

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Duplicate instance node to another instance

tayjack-2
Thanks for all of your suggestions.

It's helpful to solve my problem.

Jack




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws