Subject: Re: [xsl] Display unique values? From: andrew welch <andrew.j.welch@xxxxxxxxx> Date: Fri, 20 Jan 2006 10:00:47 +0000 |
On 1/20/06, George Cristian Bina <george@xxxxxxxxxxxxx> wrote: > Hi Alan, > > Your stylesheet looks complicated, how about: > > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:output version="1.0" encoding="UTF-8" indent="no" > omit-xml-declaration="no" > media-type="text/html"/> > > <xsl:template match="/"> > <html><table> > <thead><tr> > <td>Event</td><td>Device</td> > </tr></thead> > <tbody> > <xsl:apply-templates/> > </tbody> > </table></html> > </xsl:template> > > <xsl:template match="Event"> > <tr> > <td><xsl:value-of select="ID"/></td> > <td> > <xsl:for-each > select="EventDevicesArchive/EventDevice/Device[not(text()=../preceding-siblin g::EventDevice/Device/text())]"> > <xsl:value-of select="."/> > <xsl:if test="position()!=last()"> > <xsl:text>, </xsl:text> > </xsl:if> > </xsl:for-each> > </td> > </tr> > </xsl:template> > </xsl:stylesheet> George has a given a 1.0 solution, if you can use XSLT 2.0 then you could use the distinct-values() function: <xsl:for-each select="EventDevicesArchive/EventDevice/Device[not(text()=../preceding-siblin g::EventDevice/Device/text())]"> can become: <xsl:for-each select="distinct-values(EventDevicesArchive/EventDevice/Device)"> cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Display unique values?, George Cristian Bina | Thread | Re: [xsl] Display unique values?, Alan Fenn |
Re: [xsl] Display unique values?, George Cristian Bina | Date | [xsl] <xsl:include> using relative , Chris Ward |
Month |