Hi,

I just tried to implement the solution below for a similar problem.
But unfortunately, I can't get it to work.

My current Node is called - with ist full qualified name - 
"{http://www.lexisnexis.at/schema/norm}listeneintrag"; 
I want now want to insert two nodes after listeneintrag.
I used the paste command, but failed miserably....

Here is my code: 

<cfg:command name="insertNumListenPunkt">
                <cfg:macro>
                        <cfg:sequence>
                                <cfg:command name="selectNode" 
parameter="ancestor[implicitElement] 
{http://www.lexisnexis.at/schema/norm}listeneintrag"/>
                                <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;listeneintrag&gt;&lt;absatz&gt;&lt;/absatz&gt;&lt;/listeneintrag&gt;&lt;/ns:clipboard&gt;"/>
                        </cfg:sequence>
                </cfg:macro>
        </cfg:command>


It works fine till the selectNode. The desired node gets selected, but no 
insertion is done....
I also tried to qualify all element names in the paste command, like

<cfg:command name="insertNumListenPunkt">
                <cfg:macro>
                        <cfg:sequence>
                                <cfg:command name="selectNode" 
parameter="ancestor[implicitElement] 
{http://www.lexisnexis.at/schema/norm}listeneintrag"/>
                                <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;{http://www.lexisnexis.at/schema/norm}listnum&gt;&lt;/{http://www.lexisnexis.at/schema/norm}listnum&gt;&lt;{http://www.lexisnexis.at/schema/norm}listeneintrag&gt;&lt;{http://www.lexisnexis.at/schema/norm}absatz&gt;&lt;/{http://www.lexisnexis.at/schema/norm}absatz&gt;&lt;/{http://www.lexisnexis.at/schema/norm}listeneintrag&gt;&lt;/ns:clipboard&gt;"/>
                        </cfg:sequence>
                </cfg:macro>
        </cfg:command>

But it didn't work either.
My schema allows the insertion of the two nodes at the desired position.
Can you help me?

wbr,
Roman  

> -----Urspr?ngliche Nachricht-----
> Von: xmleditor-support-bounces at xmlmind.com 
> [mailto:xmleditor-support-bounces at xmlmind.com] Im Auftrag von 
> Hussein Shafie
> Gesendet: Dienstag, 17. Mai 2005 15:16
> An: Klocker Christoph
> Cc: xmleditor-support at xmlmind.com
> Betreff: Re: WG: [XXE] command for inserting 2 elements
> 
> 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}clipboar
> d 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.
> 
>  
> --
> XMLmind XML Editor Support List
> xmleditor-support at xmlmind.com
> http://www.xmlmind.com/mailman/listinfo/xmleditor-support
> 

Reply via email to