With the form <xsl:for-each-group select="*" group-adjacent="boolean(self::p[@class = 'code'])">
the grouping key is a boolean value that is true for adjacent p
elements having the class
attribute with value code
while with the second form <xsl:for-each-group select="*" group-adjacent="@class">
the grouping value is a string and groups all adjacent elements with the same class
attribute values.
So it depends on your needs, if you have e.g.
<items>
<item class="c1">...</item>
<item class="c1">...</item>
<item class="c2">...</item>
</items>
you can use the second approach to group on the class
value.
On the other hand, if you want to identify adjacent p
elements with a certain class
attribute, as e.g. in
<body>
<h1>...</h1>
<p class="code">...</p>
<p class="code">...</p>
<h2>...</h2>
<p class="code">...</p>
</body>
then the first approach allows that.