1

私はxslを持っています:それが表示されるとき:

  • カテゴリ
  • 画像

私が欲しいのは、すべての画像を表示することですが、それらはその画像セットですべて同じであるため、それらの上に1回だけカテゴリ名を表示します。

Q:これを達成するにはどうすればよいですか?

<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>

4

1 に答える 1

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>
于 2012-11-24T15:52:08.263 に答える