I think that this should be done via a template helper function as that would save many template changes and feels how we should do such things.  I know it complicates this example in many ways but feels like we are providing a bad example - not sure what you think?