I have a custom macro method that returns a string array of field names whose values I want to output in a Text/XML transformation. The transformation is being used as the Item Template in a Datalist. I cannot figure out though how to dynamically get the value from the current data item. It seems that DataItem
does not resolve -- nothing outputs from the GetValue
call below. Using CurrentDocument
would obviously resolve the page instead of the data item.
<tr>
<td>{% SKUNumber %}</td>
{% foreach (spec in Util.GetSpecFieldsForPageType(CurrentDocument.NodeClass, "RelatedModelsTable")) { %}
<td class="hidden-xs">{% GetValue(DataItem, spec) %} </td>
{% } #%}
</tr>
Is there any way to access the current data item in a Text/XML transformation? Or do I need to switch to an ASCX transform?