[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Formatting issue with HTML and TEXT output method

Subject: RE: Formatting issue with HTML and TEXT output method
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 17 Jul 2008 09:14:53 +0100
RE:  Formatting issue with HTML and TEXT output method
I'm having trouble understanding the question, but I suspect that what you
are looking for is that newlines in the XML should render as newlines when
the HTML is displayed in the browser. that is, if your input is

<p>
THREE
BLIND
MICE
</p>

then you want to generate HTML is such a way that the user sees three lines
of text on the browser screen.

As I expect you know, HTML treats a newline as equivalent to a space, so the
normal way to do this is to replace newlines by <br/> elements. That's easy
in XSLT 2.0 using <xsl:analyze-string>, it's a bit harder in 1.0 (google for
"XSLT 1.0 replace newline by <br>" which gives you 39,000 hits).

Another approach is to generate the <pre> tag in HTML, which causes newlines
to be rendered as newlines.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Senthilkumaravelan K [mailto:skumaravelan@xxxxxxxxxxxxxx] 
> Sent: 17 July 2008 00:39
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Formatting issue with HTML and TEXT output method
> 
> Hi All,
> We have xml
> <note>
> <cond>
> <html>
> <body>
> <p align="center">
> TESTTESTTESTTESTTESTTESTTESTTESTTEST
> TESTTESTTESTTESTTESTTESTTESTTESTTEST
> TESTTESTTESTTESTTESTTESTTESTTESTTEST
> </p>
> <p align="center">
> TESTTESTTESTTESTTESTTESTTESTTESTTEST
> TESTTESTTESTTESTTESTTESTTESTTESTTEST
> TESTTESTTESTTESTTESTTESTTESTTESTTEST
> </p>
> </body>
> </html>
> </cond>
> <note>
> 
> When we write xslt one with "html" as output method and text 
> as output method.
> 
> for html out method am using
> <xsl:value-of select="//cond">
> 
> text output method
> <xsl:copy-of select="//cond">
> 
> 
> How to make the text xslt output like formatted text output 
> pretty with alignment.
> 
> Any idea would of great help.
> 
> Thanks
> Senthil

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.