generate html from tree