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,. 

/christoph



-----Urspr?ngliche Nachricht-----
Von: Hussein Shafie [mailto:hussein at pixware.fr] 
Gesendet: Freitag, 13. Mai 2005 10:52
An: Klocker Christoph
Cc: xmleditor-support at xmlmind.com
Betreff: Re: [XXE] command for inserting 2 elements

Klocker Christoph wrote:
> I have this structure
> 
> <numbered_list>
>       <list_numbering></listnumbering>
>       <entry>
>               <absatz>STRING<absatz>
>        </entry>
> </numbered_list>
> 
> I try to achieve a command that inserts me a new <listnumbering> and a
> new <entry> as both are required, after the previous one. The carriage
> is positioned at the "STRING."
> 
>       <list_numbering></listnumbering>
>       <entry>
>               <absatz><absatz>
>        </entry>
> 
> the result should be this:
> 
> <numbered_list>
>       <list_numbering>1.1</listnumbering>
>       <entry>
>               <absatz>STRING<absatz>
>        </entry>
>       <list_numbering></listnumbering>
>       <entry>
>               <absatz><absatz>
>       </entry>
> </numbered_list>
> 
> 
> I got it working when the list_numbering is an attribute, with the
> insertNode command.

You need to write a *macro-command* for that. See 
http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch02.html

Something like:
---
   <command name="insertNumberedEntry">
     <macro>
       <sequence>
         <command name="selectNode"
                  parameter="ancestorOrSelf[implicitElement] entry"/>

         <command name="paste"
                  parameter="after <?xml 
version='1.0'?><list_numbering></listnumbering><entry><absatz><absatz></entry>"/>
       </sequence>
     </macro>
   </command>
---

Note that:
* I've not tested the above macro.
* You'll need to replace "<" by "&lt;" and ">" by "&gt;" in the 
parameter of the paste command.

See http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch06s53.html
See http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch06s35.html


Reply via email to