The unparsed-entity-uri() function is defined to return the absolute URI of the resource, because its relative URI in general doesn't mean anything outside the context of the original source document. If you want to make it relative again (either to the original base URI or to some other base URI) then you'll have to do that work yourself.
I'm not sure where the "bad entity name" comes into it. You should be using the result where a URI is expected, not where an entity name is expected.
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference