There are two types of cable-end, road or MTB. For XT you need the mountain bike version. Pull your brake lever and you'll see the shape of the cable-end, where the cable fits into the lever mechanism. Get the same one.
Don't cut it before you need to use it, or the cable strands will unravel and weaken the cable.
Cheers
Doug
If you buy one with different ends on each end of the cable and don't cut it first, then you will need a cable cutter with you on the trip.
That is why I cut mine before I leave home. I put some electrical tape around it before I cut it, I cut thru the tape and the tape that remains on the cable keeps it from unraveling. I carry one long enough for the rear, it will also work on the front if needed. I only carry one, not a pair.
Since I do not carry a cable cutter, I assume that I will later have to wrap up a long bit of excess cable hanging out of a brake unit, but I carry some tape with me so I can take care of that if necessary until I can get to someone that has a cutter.