[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: 2 unique lists
> > 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
|
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
|