Added targetRef support to templates, allow reference variables to resolve to the full reference (issue #935). Contributed by Jeremy Gustie.