Archived / Obsolete Documentation

Documentation in this space is no longer accurate.
Looking for official DSpace documentation? See all documentation

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This page assumes that you are working from DIM rather than MODS. The technique should be transferable, however, as it relies on browse-by-author and browse-by-subject pages having predictable URLs.

This page walks you through creating author links. Subject links employ the same technique.

STEP 1: Encode all URLs in Manakin

This is done so that special characters in author names don't break browsers when used in URLs. In the sitemap.xmap file inside your theme folder, add the following just under the root

<sitemap:xmap>

element:

<map:components>
  <map:transformers default="xslt">
       <map:transformer name="encodeURL" src="org.apache.cocoon.transformation.EncodeURLTransformer"/>
  </map:transformers>
</map:components>

Then, between Steps 2 and 3 lower in the file, add the following:

<map:transform type="encodeURL"/>

STEP 2: Copy templates into your theme

The XSLT that creates author listings is in themes/dri2xhtml/DS-METS-1.0-DIM.xsl. Copy two

<xsl:template>

blocks into your theme's XSLT:

  • Version 1.4, the one with
    name="itemSummaryList_DS-METS-1.0-DIM"
    (this governs authors on browse lists)
  • Version 1.4, the one with
    name="itemSummaryView_DS-METS-1.0-DIM"
    (this governs authors on item pages)
  • Version 1.5, the one with
    name="DIM-Handler.xsl"
    . Look for the template
    <xsl:template match="dim:dim" mode="itemSummaryView-DIM">

STEP 3: Alter authors to add links

The existing code looks like this in both locations:

&lt;span class="author"&gt;
    &lt;xsl:choose&gt;
        &lt;xsl:when test="$data/dim:field[@element='contributor'][@qualifier='author']"&gt;
            &lt;xsl:for-each select="$data/dim:field[@element='contributor'][@qualifier='author']"&gt;
                &lt;xsl:copy-of select="."/&gt;
                &lt;xsl:if test="count(following-sibling::dim:field[@element='contributor'][@qualifier='author']) != 0"&gt;
                    &lt;xsl:text&gt;; &lt;/xsl:text&gt;
                &lt;/xsl:if&gt;
            &lt;/xsl:for-each&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:when test="$data/dim:field[@element='creator']"&gt;
            &lt;xsl:for-each select="$data/dim:field[@element='creator']"&gt;
                &lt;xsl:copy-of select="."/&gt;
                &lt;xsl:if test="count(following-sibling::dim:field[@element='creator']) != 0"&gt;
                    &lt;xsl:text&gt;; &lt;/xsl:text&gt;
                &lt;/xsl:if&gt;
            &lt;/xsl:for-each&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:when test="$data/dim:field[@element='contributor']"&gt;
            &lt;xsl:for-each select="$data/dim:field[@element='contributor']"&gt;
                &lt;xsl:copy-of select="."/&gt;
                &lt;xsl:if test="count(following-sibling::dim:field[@element='contributor']) != 0"&gt;
                    &lt;xsl:text&gt;; &lt;/xsl:text&gt;
                &lt;/xsl:if&gt;
            &lt;/xsl:for-each&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:otherwise&gt;
            &lt;i18n:text&gt;xmlui.dri2xhtml.METS-1.0.no-author&lt;/i18n:text&gt;
        &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
&lt;/span&gt;

Inside EACH of the

&lt;xsl:for-each&gt;

blocks, add this link in version 1.4:

&lt;xsl:for-each select="$data/dim:field[@element='contributor'][@qualifier='author']"&gt;
    &lt;a&gt;
        &lt;xsl:attribute name="href"&gt;
            &lt;xsl:value-of
                select="concat($context-path,'/browse-author-items?author=')"/&gt;
            &lt;xsl:copy-of select="."/&gt;
        &lt;/xsl:attribute&gt;
        &lt;xsl:value-of select="text()"/&gt;
    &lt;/a&gt;
    &lt;xsl:if test="count(following-sibling::dim:field[@element='contributor'][@qualifier='author']) != 0"&gt;
        &lt;xsl:text&gt;; &lt;/xsl:text&gt;
    &lt;/xsl:if&gt;
&lt;/xsl:for-each&gt;

Add this link in version 1.5:

<a>
        <xsl:attribute name="href">
            <xsl:value-of
                select="concat($context-path,'/browse?value=')"/>
            <xsl:copy-of select="."/>&amp;amp;type=author
        </xsl:attribute>
        <xsl:value-of select="text()"/>
 </a>
  • No labels