Is it possible to make unique id (here as an attribute \"path\"\'s value) by implementing incremental principle?
I think you can use xsl:number
:
<xsl:template match="object/@*[last()]">
<xsl:variable name="current" select=".."/>
<xsl:copy/>
<xsl:for-each select="$folded-tree">
<xsl:for-each select="key('object-by-id',$current/@id)">
<xsl:attribute name="path">
<xsl:number level="multiple" format="1/1"/>
</xsl:attribute>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
https://xsltfiddle.liberty-development.net/pNmC4HV