[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Discard leading/trailing whitespace in <title> elements?
There is no easy way to do what you want. White space in mixed content elements is signficant. A validating editor that pretty prints your XML should not be inserting those line breaks. If the title element only permitted #PCDATA, then you could use the XSLT normalize-space() function, which would trim the leading and trailing spaces and collapse a sequence of spaces to single space. But title permits other elements too, and normalize-space() would convert those elements to strings. So you would have to write a customization that detects the first node of a title, check to see if it is a text() node, and then use the string functions to trim any leading linefeed character . Same with the trailing character of the last node of title. You can't just use normalize-space() on those nodes, because the space on the other end of the text() node is probably signficant. By the way, those line feeds in <para> actually are passed through the XSLT processor. Take a look at your HTML or FO output. I think the line building algorithms in the browser and the XSLFO processors don't display them. Bob Stayton Sagehill Enterprises DocBook Consulting bobs@sagehill.net ----- Original Message ----- From: "Paul DuBois" <paul@kitebird.com> To: <docbook-apps@lists.oasis-open.org> Sent: Tuesday, March 29, 2005 8:05 AM Subject: [docbook-apps] Discard leading/trailing whitespace in <title> elements? > I'm using DocBook XSL with FOP to generate PDF. > > With a <title> like this: > > <title>My Title</title> > > The output looks like this: > > Section X.Y "My Title" > > With a <title> like this: > > <title> > My Title > </title> > > The output looks like this, with a space between the quote characters > and the title content: > > Section X.Y " My Title " > > > This retention of surrounding whitespace around element content does > not occur for elements such as <para>. Is there something I can do > to cause surrounding whitespace to be discarded for <title> elements > as well. > > > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]