XSLT - Adding a class to something with a class?

Posted by Probocop on Stack Overflow See other posts from Stack Overflow or by Probocop
Published on 2010-05-26T09:21:20Z Indexed on 2010/05/26 9:41 UTC
Read the original article Hit count: 122

Filed under:

When using XSLT how do I apply a class to an element which already has a class? The way I'm doing it it replaces the class that is already present? How would I add the class in addition to the existing class? My code is as follows:

<xsl:if test="data[@alias = 'off'] = 1">
    <xsl:attribute name="class">off</xsl:attribute>
</xsl:if>
<xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
    <xsl:attribute name="class">active</xsl:attribute>
</xsl:if>

Thanks.

© Stack Overflow or respective owner

Related posts about xslt