Your request was a bit tricky to build around, since defensive Xerneas isn't really seen on most teams. However, I did happen to have a team built around Z-Geomancy Xerneas lying around that was very close to what you wanted. So I repurposed it a bit (and also stole some changes from a very similar AG team); here's the result.
Xerneas' role on the team is to provide cleric support and revenge kill Dragon-types like Zygarde-C, Mega Salamence, and Rayquaza. Mega Gengar improves the matchup against fatter teams by being able to trap Pokemon like Necrozma-DM and Ultra Necrozma that take advantage of Xerneas. Zygarde-C provides an essential check to Fire-types such as Primal Groudon and Ho-Oh for these two, and in general has great synergy with Mega Gengar since it can bait in Fairy-types and use Glare to boost its Hex. Ho-Oh was chosen next as a check to Arceus-Ground, which can greatly annoy Mega Gengar + Zygarde-C teams, as well a further means of taking advantage of passive Steel-types like Magearna that Xerneas tends to bait in. Roar Primal Groudon provides a Geomancy Xerneas check, Primal Kyogre switch-in, and Stealth Rock setter all in one slot. Finally, Arceus-Dark provides Defog support for Ho-Oh, and an essential check to Lunala and Psychic-types such as Ultra Necrozma and Mega Mewtwo Y.
Threatlist:
The team doesn't have a Water resist outside of Primal Groudon, which lacks Speed investment, so try to avoid situations where it is in against Groudon. Mega Gengar is running Thunder so that it can kill with some prior chip, and Ho-Oh is running max Speed in order to hit it first with Brave Bird.
Although Zygarde can wall it it's very difficult to actually kill, which is another reason we're running Thunder on Mega Gengar.
The team pretty much lacks a wincon and relies on status spam to wear down the opponent, so clerics that can't be trapped by Mega Gengar and CM + Refresh Arceus are problematic. Chansey alone walls 5/6 of the team members.