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

RE: untitled from Biray Giray: colour on first occurre

Subject: RE: untitled from Biray Giray: colour on first occurrence of an attribute value.
From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx
Date: Tue, 16 Apr 2002 09:51:06 +0100
biray
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

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-2011 All Rights Reserved.