Subject: [xsl] RE: untitled from Biray Giray: colour on first occurrence of an a ttribute value. From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx Date: Tue, 16 Apr 2002 09:51:06 +0100 |
Biray wrote: >I need to select the first occurance of values in attributes of elements and show them in different >color. Hello Biray, This is pretty much conjecture but: One approach would be to use recursion: every time you come across a new attribute value, call the template you're in with the updated list of values encountered as a parameter. The trouble here would be that it makes it difficult to apply other templates while you're stuck in a recursion loop. I wonder if you could use a key? How about <xsl:key name="firsts" match="//Content[not(./preceding::Content/@ContentText=./@ContentText)]" use="@ContentText"/> should give you a handle on all the Content nodes with ContentText attributes without precedent. Then when you were matching the Content nodes you would set the colour using <xsl:choose> <xsl:when test="(count(. | key('firsts',@ContentText)) = 1)"> - do whatever with red here </xsl:when> <xsl:otherwise> - do whatever in black here </xsl:otherwise> </xsl:choose> This works across ALL Content nodes. hth Tom Weissmann XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] generic template - possib, Jarno . Elovirta | Thread | Re: [xsl] RE: untitled from Biray G, Joerg Heinicke |
Re: [xsl] creating and accessing el, Agnes kielen | Date | Re: [xsl] cross-reference & xsl:sor, Jeni Tennison |
Month |