It's called XSLT (eXtenisble Stylesheet Language - Transformation). XSLT allows transformation of an XML document to another XML document. Since HTML is just an XML document[1], XSLT can do the job.
[1] In reality, HTML is an SGML document. XHTML is a subset of HTML that is based on XML. But this distinction isn't that important for this purpose.