On 05/16/2013 08:44 AM, Niels Grundtvig Nielsen wrote:
I have a stack of valid DITA files to rework that were originally
prepared outside XXE. They all include a <prolog> with <author>
elements, and now I want to add <metadata>. I've worked out that I need
to select the last <author> element and then Insert after to add an
empty <metadata> element, but that gives me the unfamiliar metadata >
data construct which I have to delete before I can insert <prodinfo>.

What am I doing wrong?


Nothing. XXE works this way. Please carefully read what follows because this will save you a lot of time and efforts.



If you are curious, you may want to read what follows, otherwise,
simply skip this sidebar:
------------------------------------------------------------------
Almost all DITA elements (e.g. <prolog>) are allowed to be empty. If you let XXE honors this, you end up with an unusable editor.

Therefore there is a rule[1] in the DITA configuration files which says: always add an child element to an element which is allowed to be empty.

Generally, this works very well but in the case of <metadata> the automatic choice of the child is poor (<data>). There is of course a way[2] to correct this by specifying the contents of a newly created element of a given type.

References:

[1] http://www.xmlmind.com/xmleditor/_distrib/doc/configure/newElementContent.html (elementOnlyContentNotEmpty)

[2] http://www.xmlmind.com/xmleditor/_distrib/doc/configure/elementTemplate.html
------------------------------------------------------------------




--> You should use command Replace instead of the Delete&Insert sequence. Please try this:

1) Select the <metadata> element;
2) use "Select|Select All Children" (keyboard shortcut: Esc Down);
3) use command Edit|Replace (keyboard shortcut: Ctrl-R) to *replace* all the child elements of <metadata> by <prodinfo>.

References:

http://www.xmlmind.com/xmleditor/_distrib/doc/help/selectMenu.html

http://www.xmlmind.com/xmleditor/_distrib/doc/help/editMenu.html




--> Once this is done, please select the <metadata> element and make it your default <metadata> *element* *template* by using "Options|Customize Configuration|Save Selected Element As Template".

Do not forget to check "This replaces the default, automatically generated, element template".

Tutorial:

Becoming productive
Inserting custom element templates
http://www.xmlmind.com/xmleditor/_tutorial/element_template/index.html

Screencast:

http://www.xmlmind.com/xmleditor/_tutorial/element_template/video/element_template.html

References:

http://www.xmlmind.com/xmleditor/_distrib/doc/help/customizeConfigurationMenu.html

http://www.xmlmind.com/xmleditor/_distrib/doc/help/com.xmlmind.xmleditapp.kit.part.SaveElementAsTemplateAction.Prompt.html




--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to