Re: [xsl] RE: untitled from Biray Giray: colour on first occurrence of an a ttribute value.

Subject: Re: [xsl] RE: untitled from Biray Giray: colour on first occurrence of an a ttribute value.
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 16 Apr 2002 20:05:41 +0200
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


Current Thread