[PHP] Generate HTML from XML & XSL

I can successfully generate an HTML file from a XML & XSL file using xslt_process(). However, the resultant HTML file is not well formatted. Tags are not well nested, lines are too long, etc… Is there any way to define nesting rules and such when generating the HTML?