See the documentation here: https://docs.mendix.com/refguide/xpath-keywords-and-system-variables/
Yes you can use module role variable in XPath,
Hope it helps!
When you think about it….. You CAN’T really use MODULE roles in XPath.
You can use USER roles. User roles are stored in the DB and module roles are only for in-module use, they are not stored in the DB, hence you don’t have a way to compare something to them.
Even if you check out the link wich Ronald Catersels provided, you can see that the examples are with USER roles (on APP level, not on Module level)