Klocker Christoph wrote:
> Hi,
> 
> tried now different ways, couldn't get it working....
> 
> my macro looks like you said, 
> 
> <cfg:command name="insertNumListenPunkt">
>             <cfg:macro>
>                       <cfg:sequence>
>                 <cfg:command name="selectNode" 
> parameter="ancestor[implicitElement] punkt"/>                  
>                       <cfg:command name="paste" parameter="after &lt;?xml 
> version='1.0'?&gt;listnum&gt;&lt;/listnum&gt;&lt;punkt&gt;&lt;absatz&gt;&lt;/absatz&gt;&lt;/punkt&gt;"/>
>                </cfg:sequence>
>                 </cfg:macro>
>        </cfg:command>
> 
> It stops working after the first command.
> I suppose it has something to do with my schema, as if I change it a bit, the 
> command executes.
> 
> my schema looks like this 
> <xs:element name="nummerierte_liste">
>               <xs:complexType>
>                       <xs:sequence>
>                               <xs:element name="ueberschrift" minOccurs="0"/>
>                               <xs:sequence maxOccurs="unbounded">
>                                       <xs:element name="listnum"/>
>                                       <xs:element ref="punkt"/>
>                               </xs:sequence>
>                       </xs:sequence>
>               </xs:complexType>
>       </xs:element>
> 
> I think the problem is, that I can't even insert a new listnum and punkt, by 
> pressing the "InsertAfter" button. While the punkt node() is selected I 
> cannot even select the InsertAfter button as it is greyed out,. 

No. "Insert After" simply cannot be used to insert *two* elements at the 
same time (listnum and punkt).

But the above macro-command based on "Paste After" can paste these two 
elements at the same time.

Now, your macro-command cannot work because:

[1] The parameter of the command is not well-formed XML (you forgot a 
"&lt;" before first "listnum").

[2] I forgot to wrap the two elements in a 
{http://www.xmlmind.com/xmleditor/namespace/clipboard}clipboard envelope.

Try this version:
---
<cfg:command name="insertNumListenPunkt">
   <cfg:macro>
     <cfg:sequence>
       <cfg:command name="selectNode"
                    parameter="ancestor[implicitElement] punkt"/> 
                
       <cfg:command name="paste" parameter="after
&lt;?xml version='1.0'?&gt;
&lt;ns:clipboard
xmlns:ns='http://www.xmlmind.com/xmleditor/namespace/clipboard'&gt;
&lt;listnum&gt;
&lt;/listnum&gt;
&lt;punkt&gt;
&lt;absatz&gt;
&lt;/absatz&gt;
&lt;/punkt&gt;
&lt;/ns:clipboard&gt;"/>
     </cfg:sequence>
   </cfg:macro>
</cfg:command>
---

Note that if listnum and punkt have a namespace, a proper xmlns 
attribute must be added to the parameter of the "Paste After" command.


Reply via email to