[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Display unique values?

Subject: Re: Display unique values?
From: Alan Fenn <afenn262@xxxxxxxxx>
Date: Mon, 23 Jan 2006 13:41:14 -0800 (PST)
allan fenn
Andrew,

Unfortunately, I'm using 1.0, since that's what's
supported by IE6 and Firefox. Fortunately, George's
solution worked quite well. Thanks for your help!

- Alan

--- andrew welch <andrew.j.welch@xxxxxxxxx> wrote:

> 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-sibling::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-sibling::EventDevice/Device/text())]">
> 
> can become:
> 
> <xsl:for-each
>
select="distinct-values(EventDevicesArchive/EventDevice/Device)">
> 
> cheers
> andrew
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.