[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Formating XML data in XSLT
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> </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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|