The code below is achieving the desired result but it feels sloppy. Is it possible to combine the for-each statements?
XSL:
<xsl:for-each select="ROW[Start_Time = '2:00 PM']"> <xsl:sort select="order" order="descending" data-type="number" /> <xsl:value-of select="Brand" /><br/> </xsl:for-each> Top5: <xsl:for-each select="ROW[Start_Time = '2:00 PM']"> <xsl:sort select="order" order="descending" data-type="number" /> <xsl:if test="not(position() > '5')"> <xsl:value-of select="Brand" />, </xsl:if> </xsl:for-each>
Working Output:
Nike Addidas Coke Pepsi Burger King Sprite Root Beer Brio Chinotto Top5: Nike, Addidas, Coke, Pepsi, Burger King,
Was thinking to somehow define a new variable/parameter with each loop cycle and then use:
<xsl:value-of select="$Brand_Position1" />, <xsl:value-of select="$Brand_Position2" />, ... <xsl:value-of select="$Brand_Position5" />,
I would like to make this as efficient as possible. Am new to xsl. Thank you.
No comments:
Post a Comment