Subject: RE: 2 unique lists From: Kay Michael <Michael.Kay@xxxxxxx> Date: Mon, 7 Aug 2000 18:12:10 +0100 |
> > and from this I want two unique lists of dates, thus > > person1: Feb2000, Mar2000, Apr2000. > person2: Feb2000, Mar2000, Apr2000. > > Here is the first stylesheet, using preceding: > > <xsl:template match="person"> > <xsl:value-of select="@name"/><xsl:text>: </xsl:text> > <xsl:for-each select="date[ not( . = preceding::date )]"> > <xsl:value-of select="."/> > <xsl:if test="not(position()=last())">, </xsl:if> > </xsl:for-each> > </xsl:template> > > which produces: > person1: feb2000, mar2000, Apr2000 > person2: you want preceding-sibling::date > > > I also tried the key method: > <xsl:key name="thedate" match="date" use="."/> > > <xsl:template match="person"> > <xsl:value-of select="@name"/><xsl:text>: </xsl:text> > <xsl:for-each select="date[generate-id(.) = > generate-id(key('thedate',.)[1])]"> > <xsl:value-of select="."/> > <xsl:if test="not(position()=last())">, </xsl:if> > </xsl:for-each> > </xsl:template> > > which produced the same result. You need the key value to idendify not only the date, but also the parent element. So try <xsl:key name="thedate" match="date" use="concat(generate-id(..), .)"/> Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: 2 unique lists, Spychalski, Frank | Thread | RegExp as an extension function?, Imran Rashid |
RE: 2 unique lists, Spychalski, Frank | Date | RE: a novice Q, Kay Michael |
Month |