Changeset 26176 for main


Ignore:
Timestamp:
2012-09-12T11:18:29+12:00 (12 years ago)
Author:
sjm84
Message:

Reindented the gsf:metadata template and added in the change that searches for the closest metadata list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl

    r26165 r26176  
    239239
    240240    <!-- if this gsf:metadata is a child of a document node then we want to get the metadata for that node -->
    241   <xsl:template match="gsf:metadata">
    242     <xsl:if test="not(@hidden = 'true')">
    243       <!-- set hidden=true on a gsf:metadata so that it gets retrieved from the server but not displayed -->
    244       <xsl:variable name="meta_name"><xsl:call-template name="getMetadataName"/></xsl:variable>
    245       <xsl:variable name="separator"><xsl:choose><xsl:when test="@separator"><xsl:value-of disable-output-escaping='yes' select="@separator"/></xsl:when><xsl:when test="separator"><xsl:copy-of select="separator/node()"/></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose></xsl:variable>
    246       <xsl:variable name="prefix"><xsl:choose><xsl:when test="@prefix"><xsl:value-of disable-output-escaping='yes' select="@prefix"/></xsl:when><xsl:when test="prefix"><xsl:copy-of select="prefix/node()"/></xsl:when></xsl:choose></xsl:variable>
    247       <xsl:variable name="suffix"><xsl:choose><xsl:when test="@suffix"><xsl:value-of disable-output-escaping='yes' select="@suffix"/></xsl:when><xsl:when test="suffix"><xsl:copy-of select="suffix/node()"/></xsl:when></xsl:choose></xsl:variable>
    248       <xsl:variable name="postest">
    249     <xsl:choose><xsl:when test="@pos = 'first'">position()=1</xsl:when><xsl:when test="@pos = 'last'">position() = last()</xsl:when><xsl:when test="@pos">position() = <xsl:value-of select="@pos"/></xsl:when><xsl:otherwise>true()</xsl:otherwise></xsl:choose>
    250       </xsl:variable>
    251       <xsl:variable name="multiple"><xsl:choose><xsl:when test="@pos">false()</xsl:when><xsl:otherwise>true()</xsl:otherwise></xsl:choose></xsl:variable>
    252       <xslt:for-each><xsl:attribute name="select">
    253     <xsl:if test="@type='collection'">/page/pageResponse/collection/</xsl:if>metadataList/metadata[@name='<xsl:value-of select="$meta_name"/>'<xsl:if test="@lang"><xsl:text> and @lang=</xsl:text><xsl:value-of select="@lang"/></xsl:if><xsl:text>]</xsl:text></xsl:attribute>
    254       <xslt:if test="{$postest}">
    255       <xslt:if test="{$multiple} and position()>1"><xsl:copy-of select="$separator"/></xslt:if>
    256       <xsl:copy-of select="$prefix"/>
    257       <xsl:choose>
    258         <xsl:when test="@format">
    259         <xslt:value-of disable-output-escaping='yes' select="util:{@format}(., /page/@lang )"/>
    260           </xsl:when>
    261         <xsl:otherwise>
    262           <xslt:value-of disable-output-escaping='yes' select="."/>
    263 </xsl:otherwise>
    264       </xsl:choose>
    265     </xslt:if>
    266     <xsl:copy-of select="$suffix"/>
    267     </xslt:for-each>
    268   </xsl:if>
    269   </xsl:template>
     241    <xsl:template match="gsf:metadata">
     242        <xsl:if test="not(@hidden = 'true')">
     243            <!-- set hidden=true on a gsf:metadata so that it gets retrieved from the server but not displayed -->
     244            <xsl:variable name="meta_name"><xsl:call-template name="getMetadataName"/></xsl:variable>
     245            <xsl:variable name="separator">
     246                <xsl:choose>
     247                    <xsl:when test="@separator"><xsl:value-of disable-output-escaping='yes' select="@separator"/></xsl:when>
     248                    <xsl:when test="separator"><xsl:copy-of select="separator/node()"/></xsl:when>
     249                    <xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise>
     250                </xsl:choose>
     251            </xsl:variable>
     252            <xsl:variable name="prefix">
     253                <xsl:choose>
     254                    <xsl:when test="@prefix"><xsl:value-of disable-output-escaping='yes' select="@prefix"/></xsl:when>
     255                    <xsl:when test="prefix"><xsl:copy-of select="prefix/node()"/></xsl:when>
     256                </xsl:choose>
     257            </xsl:variable>
     258            <xsl:variable name="suffix">
     259                <xsl:choose>
     260                    <xsl:when test="@suffix"><xsl:value-of disable-output-escaping='yes' select="@suffix"/></xsl:when>
     261                    <xsl:when test="suffix"><xsl:copy-of select="suffix/node()"/></xsl:when>
     262                </xsl:choose>
     263            </xsl:variable>
     264            <xsl:variable name="postest">
     265                <xsl:choose>
     266                    <xsl:when test="@pos = 'first'">position()=1</xsl:when>
     267                    <xsl:when test="@pos = 'last'">position() = last()</xsl:when>
     268                    <xsl:when test="@pos">position() = <xsl:value-of select="@pos"/></xsl:when>
     269                    <xsl:otherwise>true()</xsl:otherwise>
     270                </xsl:choose>
     271            </xsl:variable>
     272            <xsl:variable name="multiple">
     273                <xsl:choose>
     274                    <xsl:when test="@pos">false()</xsl:when>
     275                    <xsl:otherwise>true()</xsl:otherwise>
     276                </xsl:choose>
     277            </xsl:variable>
     278            <xslt:for-each>
     279                <xsl:attribute name="select">
     280                    <xsl:if test="@type='collection'">/page/pageResponse/collection/</xsl:if>(.//metadataList)[last()]/metadata[@name='<xsl:value-of select="$meta_name"/>'<xsl:if test="@lang"><xsl:text> and @lang=</xsl:text><xsl:value-of select="@lang"/></xsl:if><xsl:text>]</xsl:text>
     281                </xsl:attribute>
     282                <xslt:if test="{$postest}">
     283                    <xslt:if test="{$multiple} and position()>1"><xsl:copy-of select="$separator"/></xslt:if>
     284                    <xsl:copy-of select="$prefix"/>
     285                    <xsl:choose>
     286                        <xsl:when test="@format">
     287                            <xslt:value-of disable-output-escaping='yes' select="util:{@format}(., /page/@lang )"/>
     288                        </xsl:when>
     289                        <xsl:otherwise>
     290                            <xslt:value-of disable-output-escaping='yes' select="."/>
     291                        </xsl:otherwise>
     292                    </xsl:choose>
     293                </xslt:if>
     294                <xsl:copy-of select="$suffix"/>
     295            </xslt:for-each>
     296        </xsl:if>
     297    </xsl:template>
    270298
    271299  <xsl:template name="getMetadataName">
Note: See TracChangeset for help on using the changeset viewer.