|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Display unique values?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








