Ignore:
Timestamp:
10/25/11 10:39:52 (9 years ago)
Author:
sjm84
Message:

gsf:metadata statements will now work out where to get metadata from based on their current context, instead of always assuming that they are in a documentNode or a classifierNode

File:
1 edited

Legend:

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

    r24510 r24792  
    3939            gs.variables.<xsl:value-of select="@name"/><xslt:text disable-output-escaping="yes"> = "</xslt:text><xsl:apply-templates/><xslt:text disable-output-escaping="yes">";</xslt:text>
    4040        </script>
     41    </xsl:template>
     42   
     43    <xsl:template match="gsf:defaultClassifierNode">
     44        <xslt:call-template name="defaultClassifierNode"/>
    4145    </xsl:template>
    4246 
     
    151155    </xsl:template>
    152156
     157    <!-- if this gsf:metadata is a child of a document node then we want to get the metadata for that node -->
     158    <xsl:template match="xsl:template[@match = 'documentNode' or @match = 'classifierNode']//gsf:metadata | gsf:template[@match = 'documentNode' or @match = 'classifierNode']//gsf:metadata">
     159        <xslt:value-of disable-output-escaping="yes">
     160            <xsl:attribute name="select">
     161                <xsl:text>metadataList/metadata[@name='</xsl:text>
     162                <xsl:apply-templates select="." mode="get-metadata-name"/>
     163                <xsl:text>']</xsl:text>
     164            </xsl:attribute>
     165        </xslt:value-of>
     166    </xsl:template>
     167   
    153168    <xsl:template match="gsf:metadata">
    154169        <xslt:value-of disable-output-escaping="yes">
    155170            <xsl:attribute name="select">
    156             <xsl:text>metadataList/metadata[@name='</xsl:text>
    157             <xsl:apply-templates select="." mode="get-metadata-name"/>
    158             <xsl:text>']</xsl:text>
     171                <xsl:text>/page/pageResponse/document/documentNode/metadataList/metadata[@name='</xsl:text>
     172                <xsl:apply-templates select="." mode="get-metadata-name"/>
     173                <xsl:text>']</xsl:text>
    159174            </xsl:attribute>
    160175        </xslt:value-of>
     
    209224    </xsl:template>
    210225 
     226    <xsl:template match="xsl:template[@match = 'documentNode' or @match = 'classifierNode']//gsf:choose-metadata | gsf:template[@match = 'documentNode' or @match = 'classifierNode']//gsf:choose-metadata">
     227        <xslt:choose>
     228            <xsl:for-each select="gsf:metadata">
     229                <xslt:when>
     230                    <xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
     231                    <xsl:apply-templates select="."/>
     232                </xslt:when>
     233            </xsl:for-each>
     234            <xsl:if test="gsf:default">
     235                <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
     236            </xsl:if>
     237        </xslt:choose>
     238    </xsl:template>
     239   
    211240    <xsl:template match="gsf:choose-metadata">
    212241        <xslt:choose>
    213242            <xsl:for-each select="gsf:metadata">
    214243                <xslt:when>
    215                     <xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
     244                    <xsl:attribute name="test">/page/pageResponse/document/documentNode/metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
    216245                    <xsl:apply-templates select="."/>
    217246                </xslt:when>
Note: See TracChangeset for help on using the changeset viewer.