0
是否可以將所有內容節點存儲爲數組並傳遞給另一個模板?我已經嘗試過,但無法得到它的工作。我的選擇表達式是選擇正確的節點。在陣列中存儲節點
<xsl:variable name="array" select="/data/contents/content[ ..... ] />
<xsl:value-of select="$array/.../... " />
<xsl:variable name="bannerList" select="data/contents[$dayOfWeekIndex]/content[position() <= 5]" />
<xsl:apply-templates select="$bannerList" mode="article">
<xsl:with-param name="numberOfBanners" select="count($bannerList)" />
</xsl:apply-templates>
我想使用呼叫模板,而不是發送bannerList作爲參數。
您是否可以爲我們提供迄今爲止所擁有的示例? – JLRishe
是的,你可以傳遞一個nodeset作爲參數,就像任何其他變量一樣:' '。你的XSLT在哪裏不能按照你的預期工作? –
JLRishe
我得到了計數($ bannerList)= 1,正如我所料。但是,當我嘗試訪問另一個模板內的任何內容時select =「$ bannerList /.../@somthing」我得到一個空的結果。 – pethel