generate HTML for item from template