Search code examples
xsltdspace

DSpace logo community - DSpace 6.2 XMLUI


I've trying to edit communitylist.xsl to modify home template to add community logo but no luck yet.

I'm using XMLUI - Mirage2

here the home template example image

in: https://www.repository.cam.ac.uk/

What should I add or modify?

Thanks.


Solution

  • Our repository applies 40 different logos across the hierarchy. Here is how I have accomplished this.

    Set header variables based on community/collection handle

    <xsl:key name="myancestor" match="/dri:document/dri:meta/dri:pageMeta/dri:trail/@target|/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='request'][@qualifier='URI']/text()" use="substring-after(.,'handle/')"/>
    <xsl:variable name="IS_ZZZ" select="key('myancestor','12345/6789')"/>
    
        <xsl:choose>
            <xsl:when test="$IS_ZZZ">
                <xsl:call-template name="showLogo">
                    <xsl:with-param name="header-logo" select="concat($theme-path,'/images/zzz.png')"/>
                    <xsl:with-param name="header-logo-alt">ZZZ</xsl:with-param>
                    <xsl:with-param name="header-logo-link">http://zzz.edu</xsl:with-param>
                    <xsl:with-param name="header-logo-link-lang">ZZZ Website</xsl:with-param>
                </xsl:call-template>
            </xsl:when>
    

    When processing the header elements, insert the logo markup

    <xsl:template match="dri:div[@n='community-home' or @n='collection-home']/dri:head" priority="3">
        <xsl:call-template name="showLogo">
            <xsl:with-param name="header-logo" select="$header-logo"/>
            <xsl:with-param name="header-logo-link" select="$header-logo-link"/>
            <xsl:with-param name="header-logo-link-lang" select="$header-logo-link-lang"/>
            <xsl:with-param name="header-logo-alt" select="$header-logo-alt"/>
        </xsl:call-template>
    </xsl:template>
    
    
    <xsl:template name="showLogo">
        <xsl:param name="header-logo"/>
        <xsl:param name="header-logo-link"/>
        <xsl:param name="header-logo-link-lang"/>
        <xsl:param name="header-logo-alt"/>
        <xsl:call-template name="renderHead">
            <xsl:with-param name="class">ds-div-head</xsl:with-param>
        </xsl:call-template>
        <div class="gu-theme-logo-div">
        <a>
            <xsl:if test="$header-logo-link">
                <xsl:attribute name="href">
                    <xsl:value-of select="$header-logo-link"/>
                </xsl:attribute>
                <xsl:attribute name="title">
                    <xsl:value-of select="$header-logo-link-lang"/>
                </xsl:attribute>
            </xsl:if>
            <img class="gu-theme-logo hidden-sm hidden-xs">
                <xsl:attribute name="src">
                    <xsl:value-of select="$header-logo"/>
                </xsl:attribute>
                <xsl:attribute name="alt">
                    <xsl:value-of select="$header-logo-alt"/>
                </xsl:attribute>
            </img>
            <span class="hidden-md hidden-lg">
                <xsl:value-of select="$header-logo-link-lang"/>
            </span>
        </a>
        </div>
    </xsl:template>