| Subject: [xsl] grouping by unique... From: "Fei Zheng" <Fei.Zheng@xxxxxxx> Date: Tue, 17 Jun 2003 16:49:55 -0400 | 
I'd like to have an unique solution list.  Anyone can tell what's wrong with the following code which gives all solutions instead of the unique solutions?
The output needs to be: A B C D instead of A A B B C D. 
Thanks in advance for the help!
Here is the code.
<xsl:template match="report">
	<xsl:variable name="unique-solutions" 
    	      select="item[not(metadata/solution = preceding-sibling::metadata/solution)]/metadata/solution"	/>
					
	<xsl:for-each select="$unique-solutions">
		<xsl:sort select="." />
		<xsl:value-of select="." />
	</xsl:for-each>				
</xsl:template>
Here is the XML file.
<report>
	<item>
		<content>
			....
		</content>
		<metadata>
			<solution>A</solution>
			<solution>B</solution>
			<solution>C</solution>
		</metadata>
	</item>
	<item>
		<content>
			.....
		</content>
		<metadata>
			<solution>A</solution>
			<solution>B</solution>
			<solution>D</solution>
		</metadata>
	</item>
</report
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] passing parameters into x, Lars Huttar | Thread | Re: [xsl] grouping by unique..., J.Pietschmann | 
| Re: [xsl] Special Characters in IE , Rob Rohan | Date | Re: [xsl] coping with huge xml-saxo, Paul Tremblay | 
| Month |