refactor attrib parsing & validation (now also expands pname values)
only show "template" tab if tpl is present