This transformation:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="definition">
<xsl:apply-templates select="ancestor-or-self::*" mode="path"/>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="*" mode="path">
<xsl:value-of select="concat('/',name())"/>
<xsl:if test="../*[name()=name(current())][2]">
<xsl:value-of select=
"concat('[',count(preceding-sibling::*[name()=name(current())])+1,']')"/>
</xsl:if>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
When applied on the provided source XML document:
<odML>
<section>
<type>experiment</type>
<name>Experiment</name>
<definition></definition>
<property>
<definition></definition>
</property>
<property>
<definition></definition>
<value>
<definition></definition>
</value>
</property>
</section>
<definition></definition>
</odML>
produces the wanted, correct result:
/odML/section/definition
/odML/section/property[1]/definition
/odML/section/property[2]/definition
/odML/section/property[2]/value/definition
/odML/definition