Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: fix code markup

&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 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

Code Block
&lt;sitemap:xmap&gt;<sitemap:xmap>

element:

Code Block
&lt;map:components&gt;<map:components>
  &lt;map<map:transformers default="xslt"&gt;>
       &lt;map<map:transformer name="encodeURL" src="org.apache.cocoon.transformation.EncodeURLTransformer"/&gt;>
  &lt;</map:transformers&gt;
&lt;transformers>
</map:components&gt;components>

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

Code Block
&lt;map<map:transform type="encodeURL"/&gt;>

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

Code Block
&lt;xsl:template&gt;<xsl:template>

blocks into your theme's XSLT:

...

The existing code looks like this in both locations:

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

Inside EACH of the

Code Block
&lt;xsl<xsl:for-each&gt;each>

blocks, add this link in version 1.4:

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

Add this link in version 1.5:

Code Block
<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>