This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[docbook] Re: whitespace at the beginning and the end of element content


/ Wolfgang Jeltsch <wolfgang@jeltsch.net> was heard to say:
| in which element's content is whitespace at the beginning or the end 
| significant?  For example, if I write
|
|     <wordasword> word </wordasword>
|
| and convert to PDF, I assume that there will be a space before and after 
| "word" in the output.

Yes.

| But what if I write
|
|     <para>
|       This is a paragraph.
|     </para>?
|
| Will there be unwanted space at the beginning and the end of the paragraph or 
| are these spaces and linebreaks ignored?

As a general rule, no. It's better to write

<para>This is a paragraph.</para>

Or at least

<para>This is a paragraph.
</para>

(trailing whitespace is more likely to be irrelevant.)

However, XSL FO does have some properties for dealing with leading and
trailing whitespace in blocks. I've forgotten the details, but it's possible
that you'll be OK.

| How can I find out for which elements whitespace at the beginning and end of 
| element content is significant and for which it is not?

As a general rule, it's significant in any element that allows text
and insiginficant in elements that only allow other blocks.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com>      | In a universe of electrons and
http://www.oasis-open.org/docbook/ | selfish genes, blind physical
Chair, DocBook Technical Committee | forces and genetic replication,
                                   | some people are going to get hurt,
                                   | other people are going to get
                                   | lucky, and you won't find any
                                   | rhyme or reason in it, nor any
                                   | justice.--Richard Dawkins

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]