Michael Huebner wrote:
> 
> how can I write a command to insert an element of type Child into a 
> (possibly non-empty) element of type Parent?
> The inserted element of type Child should be inserted as the last 
> sub-element of type Parent.
> 
> Type Parent has the definition
> <!ELEMENT   Parent   (Child*) >      or      <!ELEMENT   Parent   
> (Child+) >
> or
> <!ELEMENT   Parent   (... , Child*) >   or   <!ELEMENT   Parent   (... , 
> Child+) >

The following macro-command assumes that Parent is explicitly selected. 
This is always the case if the command is triggered by a 
command-button() attached to the Parent element.

---
   <command name="appendChild">
     <macro>
       <choice>
        <command name="insert" parameter="into Child" />
         <sequence>
           <command name="selectNode" parameter="child" />
           <command name="selectNode" parameter="lastSibling" />
           <command name="insert" parameter="after Child" />
         </sequence>
       </choice>
     </macro>
   </command>
---

Note that the "firstSibling" and "lastSibling" options are not 
documented in the Power User's Guide. This documentation bug will be 
fixed in next release.



Reply via email to