I was trying to show a document's categories with a static text web part, so this may be relevant if you're using an HTML transformation, rather than ASCX:
{% foreach(cat in Documents[DocumentID].Categories){ print("<a href='"+ ResolveURL("~/wherever?category=" + cat.CategoryID) + "'>" + cat.CategoryDisplayName + "</a>"); } |(identity)GlobalAdministrator%}
Depending on the context, you could use CurrentDocument.Categories instead of Documents[DocumentID].Categories.