The answer to your first question is no. To the second "Yes, there is a plausible syntax for XML and YAML"
These are data formats and that is what they specify, with XML and YAML much more powerful than JSON. Even JSON is programming language agnostic, and apart from that there is nothing in the specifications about what would be the way to define a function that can be evaluated.
Of course it is easy to tag something in XML and YAML (each in their own specific ways). You just write a program that evaluates the tag during parsing and creates the output (from the string/scalar/complex type).
That immediately answers the question you don't seem to have asked yourself: "What language is the to be evaluated 'string' scripted in?", for which the answer is: "whatever scripting language you use in your program to evaluate the tagged data"
From a python YAML parser it is trivial to call the python interpreter to do the evaluation. From a compiled programming language you either have to call a scripting extension, or have an evaluator build into your program. You can of course also evaluate by compiling and dynamically loading, but that is probably more difficult than using an existing scriptable language.
Your example seems to use interpretation of a value based on some pattern (starting with a $
, having a $
somewhere in the string). That is the wrong way to do this, as you have to analyse each and every string and provide some escape mechanism to write an actual $
. It is much better to use tagging/attributes to actually tell the parser something special needs to be fabricated.