I have this XML:
<items> <item> <products> <product>laptop</product> <product>charger</product> </products> </item> <item> <products> <product>laptop</product> <product>headphones</product> </products> </item> </items>
I want it displayed as
laptop
charger
headphones
I tried to use distinct-values() , but I think I'm doing something wrong. Can someone tell me how to achieve this using distinct-values() ? Thank.
<xsl:template match="/"> <xsl:for-each select="//products/product/text()"> <li> <xsl:value-of select="distinct-values(.)"/> </li> </xsl:for-each> </xsl:template>
but it gives me the output as follows:
<li>laptop</li> <li>charger</li> <li>laptop></li> <li>headphones</li>
xslt
AB. Feb 18 '10 at 19:27 2010-02-18 19:27
source share