Q:

Transform HTML to HTML: use XSLT? 

I have an HTML form on which I have no control, and I would like to display the contents (labels AND input text/choices) to the client with another layout on the page (actually, to do a "review your answers" page). 
So I pretty much need to transform a complex HTML form into another HTML doc (or DOM node tree). 
It seems to me very close to the usual use case for XSL transformations, except that the input is not XML. 
I just wonder if XLST is the de-facto way to go to do that, or if I could use another technique (maybe better suited for non-XML input)? 

A:

No, you can't do this, because HTML is no XML (unless it is of doctype xhtml). 
Let me explain with a simple example:
<html>
    <body>
        <p>Para1
        <br>
        <p>Para2</p>
    </body>
</html>

This is a valid HTML-fragment, but not a wellformed XML. 
And you cannot transform invalid XML with XSL. 
If you can manage to transform the (invallid) HTML tp valid xhtm, before you transform it via XSLT, it may work.  You can try this by using jtidy,  but I have no experience with jtidy,

