OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Subject: Re: DOCBOOK-APPS: Solution to funky TOCs in HTML Help...

/ Jirka Kosek wrote:
| They are usefull, but in XSLT there is no easy way to strip leading and
| trailing new-line from
| <xxx>
| foo
| bar
| </xxx>
| strip-space instruction can be used to strip whitespace text nodes only.
| In my example, there is no whitespaceonly text node. There is just one
| text node inside xxx element. In situation like this strip-space is
| useless.

Use the normalize-space function on the node value. It strips leading and trailing space (blanks, new-lines and tabs) and replaces sequences of multiple blanks with a single blank. Of course, if the text is pre-formatted you are destroying the formatting information. Whitespace corrections should _never_ be applied to pre-formatted text nodes, it would be a violation of the basic XML rules embodied in the definition of the xml:space attribute.
Whitespace handling in XSLT is tricky, but we should be careful not to create stylesheets that prevent the writer to choose between
Personally, I usually refrain from stripping or normalizing whitespace put there by another. There is usually no way to tell if he really meant it or not. Normalization should be be done only in special cases, when you can add and strip spaces without worrying about the writer wishes (be he human or not).


Marcelo Jaccoud Amaral
Petrobras R&D Centre, Rio de Janeiro, Brazil

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Powered by eList eXpress LLC