--> There are *many* reasons which could cause the macro you wrote not to function. Possible reasons: * I don't understand your nesting of sequence and choice elements. * May be you forgot to specify namespaces (e.g. ancestor::myns:Attribut) * I don't understand the <insert/> element * I don't see the binding which binds contextualMenuChooser to the right click of the mouse. * etc.
I would recommend to re-read this section: http://www.xmlmind.com/xmleditor/_distrib/doc/commands/menu.html --> Just to prove that contextual menus work fine, I've written this code which, in my opinion, is very close to what you want to do: --- <command name="contextualMenuChooser"> <macro trace="true"> <choice> <sequence> <match context="$implicitElement" pattern="bookinfo//author//*" /> <command name="contextualMenu2" /> </sequence> <sequence> <match context="$implicitElement" pattern="bookinfo//*" /> <command name="contextualMenu1" /> </sequence> <command name="editMenu" /> </choice> </macro> </command> <command name="contextualMenu1"> <menu> <item label="Insert..." command="insert" parameter="into" /> </menu> </command> <command name="contextualMenu2"> <menu> <item label="Insert Before..." command="insert" parameter="before[implicitElement]" /> <item label="Insert After..." command="insert" parameter="after[implicitElement]" /> </menu> </command> <binding> <mousePressed button="3"/> <command name="contextualMenuChooser" /> </binding> --- In order to test the above code: [1] Copy the above code in your customize.xxe file (Install add-on called "A sample customize.xxe" if you don't have one) [2] Restart XXE and use File|New, choose a DocBook Book template (not DocBook 5, plain DocBook 4) [3] Click in the empty title of the book, then right-click: you'll see contextualMenu1 [4] Click in the empty firstname of the author of the book, then right-click: you'll see contextualMenu2 [5] Click in the empty para, then right-click: you'll see the standard editMenu Marc Haemmerle wrote: > > I?m using XML mind XML Editor 4.1 on Windows. > > I tried to extend my own context menu, depending on the chosen element. > > My code: > > > > > > <command name="contextualMenuChooser"> > > <macro> > > <sequence> > > <sequence> > > <choice> > > <test > expression="$implicitElement[ancestor::Attribut]" /> > > </choice> > > <command > name="contextualMenuAttribut" /> > > </sequence> > > <sequence> > > <choice> > > <test > expression="$implicitElement[ancestor::Beschreibung and > ancestor::Attribut]" /> > > </choice> > > <command > name="contextualMenuAttributBeschreibung" /> > > </sequence> > > </sequence> > > </macro> > > </command> > > > > <command name="contextualMenuAttribut"> > > <menu label="contextualmenu"> > > <item label="Insert..." command="insert" parameter="into" /> > > </menu> > > </command> > > > > <command name="contextualMenuAttributBeschreibung"> > > <menu label="contextualmenu"> > > <insert /> > > <item label="Insert Before..." command="insert" > > parameter="before[implicitElement]" /> > > <item label="Insert After..." command="insert" > > parameter="after[implicitElement]" /> > > </menu> > > </command> > > > > That?s not working. Is there a solution for my problem? How can I do > what I want? >

