If both have been prescribed by your physician, then he/ she knows the dangers of mixing the two drugs. However if these were not prescribed together, they are both sedatives so there really is no reason to take both at the same time.
Percocet I know is a pain killer, and Xannax is an anti-depressant, right? So it should be ok to take together, bit you should check with your dr first if s/he didn't prescribe both of them at the same time.
Mixing opiates and benzos is definitely not safe. If you are taking them as prescribed you should be fine but if you are taking excess amounts in order to get high, they slow your heart rate and two much of both could stop your heart. I had a friend die from mixing methadone and klonopins. Your doctor should know what all medications you are taking and generally won't prescribe things that are harmful when mixed. Only take the recommended dose and you should be just fine.