xslt遍历xml文件 如何动态添加div的id值
本人现在需要遍历一个xml文件
<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="projects.xsl"?><projects> <project> <Name>Project 1</Name> <ShortName></ShortName> <RepositoryHome></RepositoryHome> <CITarget></CITarget> <CheckStyleReport></CheckStyleReport> <PMDReport></PMDReport> <BuildSchedule></BuildSchedule> <TeamLead></TeamLead> <CCList></CCList> </project> <project> <Name>Project 2</Name> <ShortName></ShortName> <RepositoryHome></RepositoryHome> <CITarget></CITarget> <CheckStyleReport></CheckStyleReport> <PMDReport></PMDReport> <BuildSchedule></BuildSchedule> <TeamLead></TeamLead> <CCList></CCList> </project></projects>
<xsl:for-each select="projects/project[position()<5]"> <div class="tab2" id="@Id"> </div></xsl:for-each>
<xsl:for-each select="projects/project"> <div class="tab2"> <xsl:attribute name="id"> <xsl:value-of select="concat('tab',position())"/> </xsl:attribute> </div> </xsl:for-each>