Returns base64 encoded data that is safe for use in xml ids.
protected function encodeIdSafeBase64($data) {
// Prefix with a b to enforce that the first character is a letter.
return 'b' . rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}