<span in-context-edit="{/Properties/Data/Datum[@Name='heading']/@ID}">
<Datum ID="heading" Name="Heading" Type="String" Optimizable="true">Heading 1</Datum>
Yes it needs to be the xpath to the id not the name. Either: <span in-context-edit="{/Properties/Data/Datum[@Name='Heading']/@ID}"> or <span in-context-edit="{/Properties/Data/Datum[@ID='heading']/@ID}"> would be correct.
<span in-context-edit="{/Properties/Data/Datum[@Name='Heading']/@ID}">
<span in-context-edit="{/Properties/Data/Datum[@ID='heading']/@ID}">