That's a neat trick, but we have noticed with newer APP (Arbortext) releases that formatting.evaluateXPath() will now only work in a formatting context. That is to say, if try and run a script with that method it won't work. If you run that method from within a formatting tag then it will still work.
Either way, while I like your trick I'm not sure it is the best way to pass information between Arbortext/APP. It feels like that would be something liable to change or break between APP/Arbortext releases. It would be interesting to learn what you are trying to achieve in order to advise if there is a better way.