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

Re: Formating XML data in XSLT


gecko xslt whitespace
Cleverson Schmidt wrote:

> 
> How can I format data generated by a XSLT engine?
> I am trying to write a xml-to-java application where a class file is
> defined in a XML structure like
> 

Check Dave Pawson's xslt FAQ pages.  Basically, you do things like

- use the text output method.
- Use CDATA sections for boilerplate parts.
- Do not add formatting whitespace that you do not want to appear in the 
output.
- Use normalize-space() to eliminate extra unintended whitespace in 
character data.
- use constructions like <xsl:text>&#10;</xsl:text> if you cannot get 
the right line breaks any other way.  You can also just embed a newline 
right into an xsl:text element, and you can create a global variable for it.
- Optionally, create an internal subset DTD and define entities for 
newlines and other common character items (although I have not had to do 
this).

With these techniques and othersimilar ones you may invent, it is 
possible to write xslt code that is fairly readable and will produce 
adequately formatted output code.  Of course, it gets harder if you want 
to indent differently depending on some nesting level, but that too 
could be handled - with recursive templates.

Cheers,

Tom P




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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.