Since attributes aren't otherwise available inside a custom transformer, you might want to publish the parameters of one or more transformers inside its definition.
Publishing a parameter allows it to be set outside of the custom transformer, and then that setting can be reused for any number of parameters.
See the example in the Workspaces > Publishing Parameters topic Publishing a Parameter.