0
我有一組項目,使用按鍵的muenchian方法進行分組。這很好,但是當我嘗試用第一個x數量的項目進行操作時,它會在每個組中的x個項目上執行操作,而不是跨整個結果集合。我如何得到整個系列中每件產品的個人位置?XSLT分組項目的全局計數
<xsl:key name="pictures-by-productid" match="/dsQueryResponse/Rows/Row" use="@ProductId" />
<xsl:template match="/">
<div style="border:1px solid red; float:left;">
<xsl:apply-templates select="/" mode="sub">
</xsl:apply-templates>
</div>
</xsl:template>
和第二模板
<xsl:template match="/" mode="sub"> <xsl:for-each select="/dsQueryResponse/Rows/Row[count(. | key('pictures-by-productid', @ProductId)[1]) = 1]">
<xsl:for-each select="key('pictures-by-productid', @ProductId)">
<xsl:sort select="@PictureType" />
<div style="float:left; margin:2px;">
<img src="{@ThumbNailUrl}" width="58" /> <br />
Download
<xsl:number value="position()" format="1. " />
<xsl:value-of select="." />
</div>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
你能提供源XML? – 2009-12-14 16:09:09