On this page in the documentation you will see all of the functions that can be used in an Xpath Constraint: https://docs.mendix.com/refguide/xpath-constraint-functions/ Max is not on this list, so it cannot be used in Xpath constraints.
Xpath aggregate functions can be used only in Java actions – Max is one of these. https://docs.mendix.com/refguide/xpath-aggregate-functions/
Hope that helps.