How to get a unique value from an XSL transformation?

alor

New Member
I have the following XML file:\[code\]<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="cars.xsd"><manufacture id="1"> <make>Audi</make> <classification> <list mid="1"> <type>Sports</type> </list> <list mid="2"> <type>Compact</type> </list> <list mid="3"> <type>Compact</type> </list> </classification></manufacture><manufacture id="2"> <make>bmw</make> <classification> <list mid="1"> <type>Sports</type> </list> <list mid="2"> <type>Luxury</type> </list> <list mid="3"> <type>Luxury</type> </list> </classification></manufacture></document>\[/code\]Here is my current XSL code:\[code\]<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output doctype-public="-//WAPFORUM//DTD XHTML Mobile 1.0//EN" doctype-system="http://www.wapforum.org/DTD/xhtml-mobile10.dtd" method="xml" version="1.0" omit-xml-declaration="yes" indent="yes" encoding="UTF-8" media-type="text/html"/><xsl:template match="/"><xsl:element name="html"><xsl:element name="head"> <xsl:element name="title">Automotives</xsl:element></xsl:element><xsl:element name="body"> <xsl:element name="ul"><xsl:attribute name="class">pageitem</xsl:attribute> <xsl:for-each select="document/manufacture/classification/list"> <xsl:element name="li"> <xsl:attribute name="class">menu</xsl:attribute> <xsl:element name="p"> <xsl:attribute name="class">name</xsl:attribute> <xsl:element name="a"> <xsl:value-of select="type"/> <xsl:element name="br"/> </xsl:element> </xsl:element> </xsl:element> </xsl:for-each></xsl:element> </xsl:element> </xsl:element></xsl:template></xsl:stylesheet>\[/code\]How can I get the following output without repeating the types?\[code\]SportsCompact Luxury\[/code\]I'm new to XSLT and I've tried using generate-id() as in: Select once from duplicate XML info, display rest, and sort on a field But It didn't work for me as I couldn't understand the generate-id() code.
 
Back
Top