On 10/05/2010 06:52 PM, Philippe Nobili wrote:
>  Dear M. Shafie,
> 
> In our XMLMind configuration, we use <elementTemplate> element to change
> some of the templates for elements in our XML schema. When we add
> insert-after(),... buttons, we see the following:
> 
> + When we do not use the @selectable attribute, the new template item is
> displayed in the menu in addition to the standard element,  for instance
> for our element, which is <menu>: menu(menu). This is in line with what
> is in the documentation... but we do not want to see the duplicate
> items: menu and menu(menu)
> 
> + When we set @selectable to "override", we expected to see only one
> menu item in the generated pulldown; it is effectively what happens, but
> then our template is not executed and the default element is generated
> instead.

--> This probably happens because inserting the content of your
elementTemplate would cause the document to become invalid.

I can reproduce exactly the behavior you describe with the XHTML
configuration by adding attribute foo="bar" to the following table:

---
  <elementTemplate name="simple" selectable="override">
    <table xmlns="http://www.w3.org/1999/xhtml"; border="1">
      <tr>
        <td></td><td></td>
      </tr>
      <tr>
        <td></td><td></td>
      </tr>
    </table>
  </elementTemplate>
---

* The content of the elementTemplate is ignored when selectable="override".

* The content of the elementTemplate is inserted, but makes the document
invalid when @selectable is missing (that is, selectable="true").



--> The rationale of this behavior is that with RELAX NG you may have
competing element templates, all having  selectable="override". It's the
validity of the content of the elementTemplate given the editing context
which allows XXE to choose between the competing element templates.

Example:

---
<elementTemplate name="singular" selectable="override">
  <indexterm
    xmlns="http://docbook.org/ns/docbook";><primary></primary></indexterm>
</elementTemplate>

<elementTemplate name="startofrange" selectable="override">
  <indexterm xmlns="http://docbook.org/ns/docbook"; xml:id="???"
             class="startofrange"><primary></primary></indexterm>
</elementTemplate>

<elementTemplate name="endofrange" selectable="override">
  <indexterm xmlns="http://docbook.org/ns/docbook";
             class="endofrange" startref="???" />
</elementTemplate>
---


> 
> Did we miss something ?
> All the best,
> 
> Below the example:
>     <cfg:elementTemplate name="menu" selectable="override">
>       <menu  xmlns="http://www.cggveritas.com/geovation/module/2.0";>
>      <!-- skipped -->
>       </menu>
>     </cfg:elementTemplate>
> 
> Not OK default element is created when the generated pulldown is used.
> 
> <cfg:elementTemplate name="menu">
>       <menu  xmlns="http://www.cggveritas.com/geovation/module/2.0";>
>      <!-- skipped -->
>       </menu>
>     </cfg:elementTemplate>
> 
> Works, but then 2 items are created in the generated pulldown: "menu"
> and "menu(menu)"
 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to