0
私は以下のXMLを持っています。xslt数字を追加するループ
<employee>
<record id=1>
<fname>mark</fname>
<lname>smith</lname>
<id>10</id>
<record id=2>
........
</employee>
各レコードにidを追加して合計を取得します。
私は従業員の下にあるレコードのexect番号を知らない。 1または10または100とすることができます。
私はこのフォーラムの1つの例から以下を見つけました。私はそれを使うことができますが、これを達成するための簡単な方法ですか?
<xsl:call-template name="for.loop">
<xsl:with-param name="i">1</xsl:with-param>
<xsl:with-param name="count">10</xsl:with-param>
</xsl:call-template>
<!-- Rename "old name" elements to "new name" -->
<xsl:template name="for.loop">
<xsl:param name="i"/>
<xsl:param name="count"/>
<xsl:if test="$i <= $count">
<!-- body of the loop goes here -->
</xsl:if>
<xsl:if test="$i <= $count">
<xsl:call-template name="for.loop">
<xsl:with-param name="i">
<!-- Increment index-->
<xsl:value-of select="$i + 1"/>
</xsl:with-param>
<xsl:with-param name="count">
<xsl:value-of select="$count"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
あなたのデータは、整形式のXML(属性の周りに引用符なし)ではない、とあなたはid属性を合計するかどうか、それは明らかにされていないが、またはid要素。 –