This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: RE: untitled from Biray Giray: colour on first occurrenceof an a ttribute value.
- From: Joerg Heinicke <joerg dot heinicke at gmx dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 16 Apr 2002 20:05:41 +0200
- Subject: Re: [xsl] RE: untitled from Biray Giray: colour on first occurrenceof an a ttribute value.
- References: <9723092BA4DBD111816D0000F6B093610C27E76C@imsuklndsx1.lnd.uk.imshealth.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello Tom,
you created a little bit oversized Muenchian Method.
> I wonder if you could use a key? How about
> <xsl:key name="firsts"
> match="//Content[not(./preceding::Content/@ContentText=./@ContentText)]"
> use="@ContentText"/>
With your key you only have these nodes in your key-table, which are the
first with its attribute value. So you would not need the Muenchian
Method itself:
> <xsl:when test="(count(. | key('firsts',@ContentText)) = 1)">
An easy key('firsts',@contentText) would be enough.
But your code removes the real advantage of using keys. What you have in
your key, you can write easily in your <xsl:when>. You don't need the key.
<xsl:when test="self::Content[not(preceding::Content/@ContentText =
@ContentText)]">
It's more a processing time problem then an error. Jeni gave already the
correct code.
And one more comment: in the matcher of <xsl:key> you don't need '//'.
The key is created for all Content elements in the file, independent on
its level.
Regards,
Joerg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list