Inserting the current node to a remote target

If you are within a particular XPath context, how can you insert the
current context element (e.g. copy it) into a particular empty element?
For example, say you have the following snippet (with the `xf` prefix
bound to the XForms namespace and the `ev` prefix bound to the XML
Events namespace):

  <xf:group ref="what-you-want-to-copy">
    <xf:trigger><xf:label>Do the copy</xf:label>
      <xf:insert nodeset="instance('target')/location" origin="."
ev:event="DOMActivate"/>
    </xf:trigger>
  </xf:group>

As written, this will insert `what-you-want-to-copy` as the next sibling
of `target/location` (by rule 1.d of the processing rules for the insert
action), but we want it to be a child of `target/location` instead.  Now
`nodeset="instance('target')/location/*"` doesn't work, because that's
an empty node set, and we can't use the `current` attribute to change
the insert context or we can no longer reference
`what-you-want-to-copy`.  What's an XMLiphile to do?

Take care,

    John L. Clark  |  Systems Analyst
                   |  Cardio-Thoracic Surgery Research
 Cleveland Clinic  |  9500 Euclid Ave.   |  Cleveland, OH 44195
                   |  (216) 445-6011





Cleveland Clinic is ranked one of the top 3 hospitals in
America by U.S.News & World Report. Visit us online at
http://www.clevelandclinic.org for a complete listing of
our services, staff and locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.


===================================

Received on Friday, 2 February 2007 20:21:19 UTC