KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have XML like this: <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 to output like laptop charger headphones I was trying to use distinct-values() but I guess i m doing something wrong. Can anyone tell me how to achieve this using distinct-values() ? Thanks. <xsl:template match="/"> <xsl:for-each select="//products/product/text()"> <li> <xsl:value-of select="distinct-values(.)"/> </li> </xsl:for-each> </xsl:template> but its giving me output like this: <li>laptop</li> <li>charger</li> <li>laptop></li> <li>headphones</li>
Tags (comma-separated)
Save Edits
Cancel