Re: RE: untitled from Biray Giray: colour on first occ
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.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format