Thank you for the explanation Hussein.

It turns out I had omitted a required attribute elsewhere in the
template, and that invalidity apparently caused it not to add the text
nodes where expected.  Once I fixed the attribute problem, things are
working well again.

Boris


On Wed, 2010-03-10 at 10:27 +0100, Hussein Shafie wrote:
> Boris Goldowsky wrote:
> > If I have an elementTemplate in my config file that introduces an 
> > element, say a paragraph, is there a way to force creation of a text 
> > node in that paragraph so that users can simply click on it and start 
> > typing?  I don't know exactly why, but in some cases my templates seem 
> > to get text nodes, and sometimes they do not.
> > 
> 
> --> It's the schema which is used to decide whether a text node is
> needed or not.
> 
> If a descendant element D, contained in your element template T, is
> empty and element D has mixed or data content, then an empty text node
> is automatically inserted in D.
> 
> Your element template T needs to be structurally valid for this to work.
> 
> Example: Create a new DocBook 4 book and replace the chapter by a part.
> 
> Notice how the following template is inserted with all the needed text
> nodes. Also notice how the whitespace used to indent the elements is
> automatically removed.
> 
> ---
>   <elementTemplate name="chapter" selectable="override">
>     <part xmlns="">
>       <title></title>
>       <chapter>
>       <title></title>
>       <section>
>         <title></title>
>         <para></para>
>       </section>
>       </chapter>
>     </part>
>   </elementTemplate>
> ---
> 
> 
> 
> --> If you want to force the creation of a text node, then you need to
> add some text to your element template:
> 
> Example: instead of this:
> ---
>   <elementTemplate name="glossdef" selectable="override">
>     <glossentry xmlns="">
>       <glossterm></glossterm>
>       <glossdef>
>         <para></para>
>       </glossdef>
>     </glossentry>
>   </elementTemplate>
> ---
> 
> use this:
> ---
>   <elementTemplate name="glossdef" selectable="override">
>     <glossentry xmlns="">
>       <glossterm>TERM HERE</glossterm>
>       <glossdef>
>         <para>DEFINITION HERE</para>
>       </glossdef>
>     </glossentry>
>   </elementTemplate>
> ---
> 
> 

Reply via email to