There is a website which is invalid XHTML (some closing tags are missing).
I want to process its contents with XSLT, but therefore, I need a valid XML input.
Is it possible to save the DOM document the browser creates from the invalid XHTML input as valid XML/XHTML?
Yes it is. There are several libraries that can handle invalid markup and return it as valid xml/xhtml.
One of them is tidy http://tidy.sourceforge.net/
If you have access to the website, you could print the output into a buffer and then clean it …
BTW: valid xhtml is also valid xml.