XSLT atribute tip

If you want to add a class ore just toggle between two classes, there’s lots of ways to do this ,.. but I think this is by far the smartest way ,. (c:

<div>
   <xsl:if test="@id = $sc_item/ancestor-or-self::item/@id">
       <xsl:attribute name="class">active</xsl:attribute>
   </xsl:if>
   Blah ,blah ,.. mjau mjau ,..
<div>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: