What is the function of the protruding outlet on the Trent XWB?
That is the drain mast and breather outlet combined. There's some discussion about this in airliners.net (not the same engine, but I sure they are similar):

The exhaust from the air/oil separator goes out here. Usually hot air, but when the engine is running at idle you can see smoke coming out. This is engine oil that has got past the seals. The smoke stops as the engine speeds up, the air pressure increases, and the seals work properly.
Also in the main body of the mast are four holes. These are tell tale drains from various parts of the gearbox. They drain out the cavity between the accessories (starter, fuel pump, hyd pump etc.) and the gearbox.

You can see the drain in the cutaway of Trent 500 here. Here's a closeup of the part in question:

Trent XWB drain; image from a380.boards.net; credited to Part of the Trent XWB by JKKW, on Flickr