Yvonne Aburrow wrote: > > I am trying to insert an element using an insert-button(). > > Here's the excerpt from the schema: > > <xs:element name="book"> > <xs:complexType> > <xs:all> > <xs:element name="section" minOccurs="0"> > <xs:complexType> > <xs:all> > <xs:element name="chapter"/> > <xs:element name="pagefrom" type="xs:string" minOccurs="0"/> > <xs:element name="pageto" type="xs:string" minOccurs="0"/> > </xs:all> > </xs:complexType> > </xs:element> > <xs:element name="location" minOccurs="0"> > <xs:complexType> > <xs:all> > <xs:element name="placeofpublication" type="xs:string" minOccurs="0"/> > <xs:element name="publisher" type="xs:string" minOccurs="0"/> > </xs:all> > </xs:complexType> > </xs:element> > </xs:all> > <xs:attribute name="title"/> > </xs:complexType> > </xs:element> > > As I have an xs:all I should be able to insert both section and location in > book, but when the insert button is attached to book using book:after, it > only allows me to insert one but not both.
The "insert into" command (which is invoked by the insert-button) allows to insert a section or a location into an *empty* book element. After the book contains a section or a location, the "insert into" command is disabled. In such case, you need [1] to select the child of book; [2] to use "insert before" or "insert after" to add the other possible child. In a nutshell, you cannot use the very simple insert-button, you need to use a command-button with a menu containing labels "section" and "location", with each menu item invoking the same ``smart'' macro-command. See http://www.xmlmind.com/xmleditor/_distrib/docs/csssupport/ch05s06.html See http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch02.html This macro-command is sketched here: --- <command name="deleteWord"> <macro> <choice> <command name="insert" parameter="into section"/> <sequence> <command name="selectNode" parameter="firstChild"/> <command name="insert" parameter="after location"/> </sequence> </choice> </macro> </command> --- With the proper parameters, it becomes: --- <command name="deleteWord"> <macro> <choice> <command name="insert" parameter="into %0"/> <sequence> <command name="selectNode" parameter="firstChild"/> <command name="insert" parameter="after %1"/> </sequence> </choice> </macro> </command> --- First menu item must invoke this macro with parameter "section location". Second menu item must invoke this macro with parameter "location section". --- PS: You need to write a configuration for your schema because otherwise XXE will think you are opening DocBook documents (root element is "book" without a namespace).

