[thelist] XML > XSL > HTML question

Matt Patterson ltu97mp at reading.ac.uk
Fri May 25 07:20:33 CDT 2001


On 24/5/01 at 3:29 pm, Kerin.Cosford at current-drugs.com (Kerin Cosford) wrote:

> A couple of parts of my XML file hold large chunks of text. When I view the
> XML file, I can see that the text (in CDATA[]) is nicely formatted with
> carriage returns. Obviously though, XSL strips out all extraneous
> whitespace, so I just end up with these *huge* blocks of text with no
> linebreaks.

If I may...

Why are you storing large chunks of continuous text so crudely?

<large chunk>all my continuous text</large chunk>

Why not store it properly structured, with the paragraphs (which I assume are
the things delimited by your carriage returns) in their own elements.

<large chunk><para>some of my continuous text</para><para>some more
text</para></large chunk>
 
> Now, I know how to get XSL to preserve whitespace, but thats no good - the
> text comes through still formatted, but obviously newline characters mean
> nothing to HTML - what I need to do is convert the newlines to <br>s, or
> <p>s, or whatever.

CDATA sections are for data which shouldn't be parsed...

You could replace the newlines with entities which parse to <br /> or something
like that and store your data as PCDATA, but that might complicate things
more...

Give me fine granularity or give me death! (or something...)

Matt

-------------------------------------------------------------------------

Matt Patterson:
   Student
   Reading University
   Department of Typography & Graphic Communication

   ltu97mp at reading.ac.uk
   
   http://www.rdg.ac.uk/~ltu97mp/

   Piglet took Pooh's arm, in case Pooh was frightened.
   'Is it one of the Fiercer Animals?' he said, looking the other way.
   Pooh nodded. 
   'It's a Jagular,' he said.
   'What do Jagulars do?' asked Piglet, hoping that they wouldn't.




More information about the thelist mailing list