Re: How to add multiple formats for <li> element in <ul>


Ozana Dragomir
 

Here is our code for different bullet colours:

In lists-attr.xsl

    <xsl:variable name="custom-color-purple">#72166B</xsl:variable>
    <xsl:variable name="custom-color-blue">#6687B7</xsl:variable>

    <xsl:attribute-set name="ul.li__label__content">
        <xsl:attribute name="text-align">start</xsl:attribute>
        <!-- change second level bullet color to blue and third level bullet color to purple -->
        <xsl:attribute name="color">
            <xsl:choose>
                <xsl:when test="count(ancestor::*[contains(@class, ' topic/ul ')]) = 2">
                    <xsl:value-of select="$custom-color-blue"/>
                </xsl:when>
                <xsl:when test="count(ancestor::*[contains(@class, ' topic/ul ')]) = 3">
                    <xsl:value-of select="$custom-color-purple"/>
                </xsl:when>
                <xsl:otherwise>black</xsl:otherwise>
            </xsl:choose>
        </xsl:attribute>
    </xsl:attribute-set>


I hope this helps.

Best regards,
Ozana

Join main@dita-users.groups.io to automatically receive all group messages.