Does one use 'a' or 'an' before the word X-Ray?

Solution 1:

Definitely "an". The word X-ray is never pronounced any way other than "exray", and as has been discussed before, the choice of a or an is based solely on pronunciation, regardless of spelling. Since X-ray is pronounced beginning with a vowel, it must be preceded by an.

Solution 2:

'an', because how it sounds is what matters.

An interesting example is an hour, et. al. The fact that h is not considered a vowel from the article point of view says a lot about English pronunciation.

Another interesting example of article form leaking unusual information, from Life, the Universe and Everything:

"I think," said Ford in a tone of voice which Arthur by now recognized as one which presaged something utterly unintelligible, "that there's an SEP over there."

It means that the author meant that SEP achronym is to be pronounced 'es ee pee' and never 'sep'.