我有一个xsl:当显示:
我想要的是显示所有图像,但仅在其上方显示一个类别名称,因为它们对于该图像集都是相同的。
问:我如何做到这一点?<xsl:for-each select="/data/commissions/entry">
<xsl:variable name="category-path" select="commission-category"/>
<xsl:for-each select="imageset/item">
<xsl:variable name="image-path" select="image/filename"/>
<li>
<!-- this is the category name -->
<xsl:value-of select="$name-path" />
<!-- this is the photo -->
<img src="{$image-path}" alt="" />
</li>
</xsl:for-each>
答案 0 :(得分:1)
移动它:
<xsl:value-of select="$name-path" />
在 <xsl:for-each>
指令之前:
<xsl:for-each select="/data/commissions/entry">
<xsl:variable name="category-path" select="commission-category"/>
<!-- this is the category name -->
<xsl:value-of select="$name-path" />
<xsl:for-each select="imageset/item">
<xsl:variable name="image-path" select="image/filename"/>
<li>
<!-- this is the photo -->
<img src="{$image-path}" alt="" />
</li>
</xsl:for-each>