This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
Re: [docbook] Re: whitespace at the beginning and the end of element content
Am Sonntag, 31. Oktober 2004 17:45 schrieb Norman Walsh:
> [...]
> > 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.)
Oh, that's bad news. How do I format the source code of a longer paragraph
then? This way?
<para>This is an attempt
to format a longer paragraph
without getting problems
with whitespace.</para>
But this looks ugly, IMO. The way I formatted the paragraph in my previous
mail (see above) seems much more natural to me.
And even if I format the paragraph without whitespace after the start tag and
before the end tag, how can I be sure that linebreaks and the spaces used for
indenting don't appear in the output?
Section 2.10 of "Extensible Markup Language (XML) 1.0 (Third Edition)" is very
vague. It speaks about white space that is used "to set apart the markup for
greater readability". It says about this kind of whitespace: "Such white
space is typically not intended for inclusion in the delivered version of the
document."
But who decides which whitespace shall be considered whitespace used to set
apart the markup? Is whitespace appearing immediately after a start tag or
immediately before an end tag considered such whitespace or not? Does the
answer to this question depend on the document type?
And what do they mean with the "delivered version"? Do they mean something
like a PDF file or do they mean another XML file which is produced from the
original XML file by doing things like stripping whitespace?
> 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.
And what if I don't use XSL-FO? I want to produce DocBook XML documents which
will be interpreted correctly, independently of the processing software. So
where it is specified which whitespace is considered significant and which is
not?
> [...]
> Be seeing you,
> norm
Best regards,
Wolfgang