(Recursion) auto-incrementation for all depth level elements and keeping heredity path in chain

后端 未结 1 853
一个人的身影
一个人的身影 2021-01-28 15:24

Is it possible to make unique id (here as an attribute \"path\"\'s value) by implementing incremental principle?

  • for 3 lvl depth recursion, for example it would lo
相关标签:
1条回答
  • 2021-01-28 15:47

    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

    0 讨论(0)
提交回复
热议问题