Re: [docbook-apps] Discard leading/trailing whitespace in <title>elements?

From
Jirka Kosek <>
Date
2005-03-30T15:20:58+00:00
ID
Thread
Re: [docbook-apps] Discard leading/trailing whitespace in <title>elements?
Martin Wheeler wrote:

>> Why not just use <para>Some text here.</para>?
> 
> 
> Probably for the same reason that you don't use:
> <para>Some text here.</para><para>Some more text here.</para><para>Yet 
> more text here.</para><para>Still further text here.</para>

These two examples are completely different. Element para has mixed 
content -- it can contain both text and nested elements (links, phrase 
markup, etc.) on the same level. In mixed content you must preserve all 
whitespace and thus it is not safe to use whitespace to pretty-print 
your XML source. So writing

<para>
Some text here.
</para>

is always bad, because you have space before first word "Some". You will 
not notice this space in most output formats, because processing rules 
of HTML and XSL-FO discrad this sort of spaces. But this is not general 
rule and some tools will show this space -- try DSSSL stylesheets and 
RTF output. You will get very ugly output.

OTOH it is your choice whether you write:

<para>Some text here.</para><para>Some other text here.</para>

or

<para>Some text here.</para>
<para>Some other text here.</para>

or even

<para>Some text here.</para>

<para>Some other text here.</para>

It is because parent (typically section or chapter) of element para 
doesn't have mixed content, it can directly contain only other elements. 
In this case processing tools know that whitespace between para elements 
is insignificant and can be safely discarded.

-- 
------------------------------------------------------------------
   Jirka Kosek     e-mail:      http://www.kosek.cz
------------------------------------------------------------------
   Profesionální školení a poradenství v oblasti technologií XML.
      Podívejte se na náš nově spuštěný web http://DocBook.cz
        Podrobný přehled školení http://xmlguru.cz/skoleni/
------------------------------------------------------------------