Not anything you want to do each time a transformation is displayed. Meaning if you're retieving 100 items in a repeater, that code will execute 100 times.
Maybe you want to display the parent page name and not get the template information from the page? If so you can use a macro in your text/html transformation like so:
{%CurrentDocument.Parent.DocumentName|(identity)GlobalAdministrator%}