This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE: untitled from Biray Giray: colour on first occurrenceof an a ttribute value.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]