You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Hahn Kurt (CHA)" <ku...@etat.ge.ch> on 2002/06/20 14:45:58 UTC

Keep line-breaks in elements retrieved from DB

I'm creating a  pdf-application, and all its contents are retrieved with the
SQL transformer in Cocoon. Some of the db-fields are very long (max.2000
chars), but they are stored with their line-breaks. If I retrieve the data
through another frontend-application, I get all these line-breaks, which
allow me to display the text properly. However, in Cocoon, they seem to be
stripped away. Even if disable all following transformers, thus just
retrieving the data, I can't see where the line-breaks are gone. Would
anybody know something about that? I really need to have these line-breaks,
otherwise it's impossible to display the text correctly.

Thx

Kurt

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Keep line-breaks in elements retrieved from DB

Posted by Bertrand Delacretaz <bd...@codeconsult.ch>.
On Thursday 20 June 2002 14:45, Hahn Kurt (CHA) wrote:
>. . .
> Some of the db-fields are very long
> (max.2000 chars), but they are stored with their line-breaks. If I retrieve
> the data through another frontend-application, I get all these line-breaks,
> which allow me to display the text properly. However, in Cocoon, they seem
> to be stripped away. 

Are they stripped away by the SQLTransformer already?
The best thing is to check with wget to make sure the browser does not come 
into play, on a pipeline where SQLTransformer is the last one.

If not, you should be able to post-process the SQLTransformer output to 
create proper XML structures, something like

<column-1>
  <line>first line</line>
  <line>second line</line>
</column-1>

This becomes then an XSLT problem, where you will have to play with the 
xsl:preserve-space settings and "parse" the strings yourself using XSLT 
string functions.

-Bertrand

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Keep line-breaks in elements retrieved from DB

Posted by leo leonid <te...@leonid.de>.
On Thursday, June 20, 2002, at 02:45  Uhr, Hahn Kurt (CHA) wrote:

> I'm creating a  pdf-application, and all its contents are retrieved 
> with the
> SQL transformer in Cocoon. Some of the db-fields are very long (max.2000
> chars), but they are stored with their line-breaks. If I retrieve the 
> data
> through another frontend-application, I get all these line-breaks, which
> allow me to display the text properly. However, in Cocoon, they seem to 
> be
> stripped away.

I suppose they are still there, as  \n or \r in the DB or translated to 
&#xA; in XML

> Even if disable all following transformers, thus just
> retrieving the data, I can't see where the line-breaks are gone. Would
> anybody know something about that? I really need to have these 
> line-breaks,
> otherwise it's impossible to display the text correctly.
>
> Thx
>
> Kurt
>


you can write an xsl template that tests strings on &#xA; like
	<xsl:when test="contains($text, '&#xA;')">
and substitute it with a line break element.
/Leo


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>