Reputation: 3162
I have a for-each loop to get data
<xsl:for-each select="data/table0/item">
<xsl:value-of select="UIXsltUtils:BuildLink(tag)" disable-output-escaping="yes"/>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
-> Result:
dap, dinh-vu, iphone 6, mephone8, o-nhiem, bb, sai-pham, xu-phat
I want to use this string to set value of an attribute of a div (In other block of xslt code)
<div class="clearfix m-t-5" initData="init('{$NeedDataAboveHere}','the-thao')">
The result I want is:
<div class="clearfix m-t-5" initData="init('dap, dinh-vu, iphone 6, mephone8, o-nhiem, bb, sai-pham, xu-phat','the-thao')">
Upvotes: 0
Views: 1295
Reputation: 7905
You can simply do this :
<xsl:variable name="NeedDataAboveHere">
<xsl:for-each select="data/table0/item">
<xsl:value-of select="UIXsltUtils:BuildLink(tag)" />
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</xsl:variable>
to store the result of your for-each.
Then the line
<div class="clearfix m-t-5" initData="init('{$NeedDataAboveHere}','the-thao')">
should retrieve the desired value.
Upvotes: 3