Just a detail, but these 'short ifs' are normally written like this (more similar to normal if):

      (condition)? a : b

In your case:

      (format == XML)? "contextValue" : "value"

Note that there is no space before '?', while there is one after it.
As always, just a matter of having coherent source code.