在不同循环中增加一个属性id,但id必须在XSLT中是唯一的

问题描述:

我的问题是关于如何在不同的循环中增加属性id,但id必须在XSLT中是唯一的?在不同循环中增加一个属性id,但id必须在XSLT中是唯一的

+0

哪里是你的XSLT?什么问题你完全面对。 – Rupesh

+0

XSL:换各> 的xsl:for-each>的 XSL:模板> –

+0

我需要在2个循环之间以全局方式递增ID @Rupesh –

对于当前的需求,你可以处理这只是这样

<xsl:template match="Records"> 
    <xsl:for-each select="//Person|//Entity"> 
     <Entity> 
      <xsl:attribute name="ID" select="position()"/> 
      <xsl:choose> 
       <xsl:when test="self::Person"> 
        <Type>Individual</Type> 
        <Gender>Male</Gender> 
        <xsl:copy-of select="descendant::FirstName"/> 
       </xsl:when> 
       <xsl:otherwise> 
        <Type>Business</Type> 
        <Full_Name><xsl:value-of select="descendant::EntityName"/></Full_Name> 
       </xsl:otherwise> 
      </xsl:choose> 
     </Entity> 
    </xsl:for-each> 
</xsl:template> 
+0

由于@Rupesh ...一张更多怀疑。由于我是XSLT新手,我不确定很多事情。 –

+0

是否可以从标签中删除重复项? –

+0

是@nandhinisuresh – Rupesh