Changeset 26460 for main/trunk


Ignore:
Timestamp:
2012-11-14T15:41:12+13:00 (11 years ago)
Author:
sjm84
Message:

Reformatting this file

File:
1 edited

Legend:

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

    r26439 r26460  
    1111    <xsl:param name="site_name"/>
    1212    <xsl:param name="collName"/>
    13  
     13
    1414    <xsl:output method="xml"/>
    1515    <xsl:namespace-alias stylesheet-prefix="xslt" result-prefix="xsl"/>
     
    2020        </format>
    2121    </xsl:template>
    22  
     22
    2323    <xsl:template match="gsf:template">
    2424        <xslt:template>
     
    3232        </xslt:template>
    3333    </xsl:template>
    34    
     34
    3535    <xsl:template match="gsf:variable">
    3636        <xslt:variable>
     
    3939        </xslt:variable>
    4040        <script type="text/javascript">
    41             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>
     41            gs.variables.<xsl:value-of select="@name"/>
     42            <xslt:text disable-output-escaping="yes"> = "</xslt:text>
     43            <xsl:apply-templates/>
     44            <xslt:text disable-output-escaping="yes">";</xslt:text>
    4245        </script>
    4346    </xsl:template>
    44    
     47
    4548    <xsl:template match="gsf:defaultClassifierNode">
    4649        <xslt:call-template name="defaultClassifierNode"/>
     
    4952
    5053    <xsl:template match="gsf:script[@src]">
    51       <script>
    52         <xsl:attribute name='src'>
    53           <xsl:value-of select="@src"/>     
    54         </xsl:attribute>
    55         <xslt:attribute name='type'>text/javascript</xslt:attribute>
    56         <xslt:comment></xslt:comment><!-- comment used to ensure script tag is not collapsed -->
    57       </script>
     54        <script>
     55            <xsl:attribute name='src'>
     56                <xsl:value-of select="@src"/>       
     57            </xsl:attribute>
     58            <xslt:attribute name='type'>text/javascript</xslt:attribute>
     59            <xslt:comment/>
     60            <!-- comment used to ensure script tag is not collapsed -->
     61        </script>
    5862    </xsl:template>
    5963
    6064
    6165    <xsl:template match="gsf:script">
    62       <script type="text/javascript">
    63         <xslt:text disable-output-escaping="yes">
    64           <xsl:apply-templates/>
    65         </xslt:text>
    66       </script>
     66        <script type="text/javascript">
     67            <xslt:text disable-output-escaping="yes">
     68                <xsl:apply-templates/>
     69            </xslt:text>
     70        </script>
    6771    </xsl:template>
    6872
    6973
    7074    <xsl:template match="gsf:style[@src]">
    71       <link rel="stylesheet" type="text/css">
    72         <xsl:attribute name='href'>
    73           <xsl:value-of select="@src"/>     
    74         </xsl:attribute>
    75       </link>
     75        <link rel="stylesheet" type="text/css">
     76            <xsl:attribute name='href'>
     77                <xsl:value-of select="@src"/>       
     78            </xsl:attribute>
     79        </link>
    7680    </xsl:template>
    7781
    7882    <xsl:template match="gsf:style">
    79       <style type="text/css">
    80           <xsl:apply-templates/>
    81       </style>
     83        <style type="text/css">
     84            <xsl:apply-templates/>
     85        </style>
    8286    </xsl:template>
    8387
     
    105109
    106110    <xsl:template match="gsf:link">
    107     <xslt:variable name="collName" select="/page/pageResponse/collection/@name"/>
    108     <xsl:variable name="opt-title">                 
    109       <xsl:choose>
    110     <xsl:when test="@title"><xslt:attribute name="title"><xsl:value-of select="@title"/></xslt:attribute></xsl:when>
    111     <xsl:when test="@titlekey"><xslt:attribute name="title"><xslt:value-of disable-output-escaping="yes" select="util:getCollectionText($collName, $site_name, /page/@lang, '{@titlekey}')"/></xslt:attribute></xsl:when>
    112       </xsl:choose>
    113     </xsl:variable>
     111        <xslt:variable name="collName" select="/page/pageResponse/collection/@name"/>
     112        <xsl:variable name="opt-title">                 
     113            <xsl:choose>
     114                <xsl:when test="@title">
     115                    <xslt:attribute name="title">
     116                        <xsl:value-of select="@title"/>
     117                    </xslt:attribute>
     118                </xsl:when>
     119                <xsl:when test="@titlekey">
     120                    <xslt:attribute name="title">
     121                        <xslt:value-of disable-output-escaping="yes" select="util:getCollectionText($collName, $site_name, /page/@lang, '{@titlekey}')"/>
     122                    </xslt:attribute>
     123                </xsl:when>
     124            </xsl:choose>
     125        </xsl:variable>
    114126        <xsl:choose>
    115127            <xsl:when test="@type='query'">
     
    129141                        </xsl:choose>
    130142                    </xslt:attribute>
    131                                         <xsl:copy-of select="$opt-title"/>
     143                    <xsl:copy-of select="$opt-title"/>
    132144                    <xsl:apply-templates/>
    133145                </a>
     
    149161                        </xsl:choose>
    150162                    </xslt:attribute>
    151                                         <xsl:copy-of select="$opt-title"/>
     163                    <xsl:copy-of select="$opt-title"/>
    152164                    <xsl:apply-templates/>
    153165                </a>
    154166            </xsl:when>
    155167            <xsl:when test="@type='source'">
    156                 <a><xslt:attribute name='href'><xslt:value-of
     168                <a>
     169                    <xslt:attribute name='href'>
     170                        <xslt:value-of
    157171                   disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']" />/index/assoc/<xslt:value-of
    158172                   disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name='assocfilepath']" />/<xslt:value-of
    159                    disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name='srclinkFile']" /></xslt:attribute>
    160                                   <xsl:copy-of select="$opt-title"/>
    161                   <xsl:apply-templates/>
     173                   disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name='srclinkFile']" />
     174                    </xslt:attribute>
     175                    <xsl:copy-of select="$opt-title"/>
     176                    <xsl:apply-templates/>
    162177                </a>
    163178            </xsl:when>
    164179            <xsl:when test="@type='web'">
    165     <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, 'weblink')]"/>
    166               <xsl:apply-templates/>
    167               <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, '/weblink')]"/>
     180                <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, 'weblink')]"/>
     181                <xsl:apply-templates/>
     182                <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, '/weblink')]"/>
    168183            </xsl:when>
    169184            <xsl:when test="@type='page'">
     
    176191                        <xsl:value-of select="@page"/>
    177192                    </xslt:attribute>
    178                                     <xsl:copy-of select="$opt-title"/>
    179                 <xsl:apply-templates/>
     193                    <xsl:copy-of select="$opt-title"/>
     194                    <xsl:apply-templates/>
    180195                </a>   
    181196            </xsl:when>
    182197            <xsl:when test="@type='equivdoc'">
    183               <xsl:call-template name="gsf:equivlinkgs3"/>
    184             </xsl:when>
    185             <xsl:otherwise> <!-- a document link -->
     198                <xsl:call-template name="gsf:equivlinkgs3"/>
     199            </xsl:when>
     200            <xsl:otherwise>
     201                <!-- a document link -->
    186202                <xslt:variable name="bookswitch">
    187203                    <xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
    188204                </xslt:variable>
    189205                <a>
    190                               <xsl:copy-of select="$opt-title"/>
     206                    <xsl:copy-of select="$opt-title"/>
    191207                    <xslt:attribute name="href">
    192208                        <xslt:value-of select='$library_name'/>
     
    194210                        <xslt:value-of select='/page/pageResponse/collection/@name'/>
    195211                        <xsl:text>/document/</xsl:text>
    196         <xsl:choose><xsl:when test="@OID"><xsl:value-of select="@OID"/></xsl:when><xsl:when test="@OIDmetadata"><xsl:variable name="OIDmeta" select="@OIDmetadata"/><xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$OIDmeta}']"/></xsl:when><xsl:otherwise>
    197                         <xslt:value-of select='@nodeID'/></xsl:otherwise></xsl:choose>
     212                        <xsl:choose>
     213                            <xsl:when test="@OID">
     214                                <xsl:value-of select="@OID"/>
     215                            </xsl:when>
     216                            <xsl:when test="@OIDmetadata">
     217                                <xsl:variable name="OIDmeta" select="@OIDmetadata"/>
     218                                <xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$OIDmeta}']"/>
     219                            </xsl:when>
     220                            <xsl:otherwise>
     221                                <xslt:value-of select='@nodeID'/>
     222                            </xsl:otherwise>
     223                        </xsl:choose>
    198224                        <xslt:choose>
    199225                            <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
     
    201227                            </xslt:when>
    202228                            <xslt:otherwise>
    203                                 <xslt:if test="$opt-doc-link-args">?<xslt:value-of select="$opt-doc-link-args"/></xslt:if>
     229                                <xslt:if test="$opt-doc-link-args">?<xslt:value-of select="$opt-doc-link-args"/>
     230                                </xslt:if>
    204231                            </xslt:otherwise>
    205232                        </xslt:choose>
     
    214241        <xsl:choose>
    215242            <xsl:when test="@type='classifier'">
    216                 <img style="border:0px"><xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/></xsl:attribute></img>
     243                <img style="border:0px">
     244                    <xsl:attribute name="src">
     245                        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/>
     246                    </xsl:attribute>
     247                </img>
    217248            </xsl:when>
    218249            <xsl:when test="@type='web'">
    219               <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, 'webicon')]"/>             
     250                <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, 'webicon')]"/>               
    220251            </xsl:when>
    221252            <xsl:when test="@file">
    222               <img>
    223                 <xslt:attribute name='src'>
    224                   <xsl:choose>
    225                 <xsl:when test="not(@select) or @select='site'">
    226                   <xsl:value-of disable-output-escaping="yes" select="concat('interfaces/',$interface_name,'/images/',@file)"/>
    227                 </xsl:when>
    228                 <xsl:when test="@select='collection'">
    229                   <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
    230                   <xsl:value-of disable-output-escaping="yes" select="concat('/images/',@file)"/>
    231                 </xsl:when>
    232                   </xsl:choose>             
    233                 </xslt:attribute>
    234               </img>
     253                <img>
     254                    <xslt:attribute name='src'>
     255                        <xsl:choose>
     256                            <xsl:when test="not(@select) or @select='site'">
     257                                <xsl:value-of disable-output-escaping="yes" select="concat('interfaces/',$interface_name,'/images/',@file)"/>
     258                            </xsl:when>
     259                            <xsl:when test="@select='collection'">
     260                                <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
     261                                <xsl:value-of disable-output-escaping="yes" select="concat('/images/',@file)"/>
     262                            </xsl:when>
     263                        </xsl:choose>               
     264                    </xslt:attribute>
     265                </img>
    235266            </xsl:when>
    236267            <xsl:when test="not(@type) or @type='document'">
    237                 <img style="border:0px"><xslt:attribute name="id">documentBasketBook<xslt:value-of select="/page/pageResponse/collection/@name"/>:<xslt:value-of select="@nodeID"/></xslt:attribute><xslt:attribute name="src">
    238                     <xslt:choose>
    239                         <xslt:when test="@docType='hierarchy' and @nodeType='root'">
    240                             <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'book_image')"/>
    241                         </xslt:when>
    242                         <xslt:otherwise>
    243                             <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_icon_image')"/>
    244                         </xslt:otherwise>
    245                     </xslt:choose>
    246                 </xslt:attribute></img>
     268                <img style="border:0px">
     269                    <xslt:attribute name="id">documentBasketBook<xslt:value-of select="/page/pageResponse/collection/@name"/>:<xslt:value-of select="@nodeID"/>
     270                    </xslt:attribute>
     271                    <xslt:attribute name="src">
     272                        <xslt:choose>
     273                            <xslt:when test="@docType='hierarchy' and @nodeType='root'">
     274                                <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'book_image')"/>
     275                            </xslt:when>
     276                            <xslt:otherwise>
     277                                <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_icon_image')"/>
     278                            </xslt:otherwise>
     279                        </xslt:choose>
     280                    </xslt:attribute>
     281                </img>
    247282            </xsl:when>
    248283        </xsl:choose>
    249284    </xsl:template>
    250    
    251   <!-- calls a template in gslib.xsl in order to avoid xsl vs xslt issue -->
    252   <!--<xsl:template match="gsf:equivlinkgs3">
     285
     286    <!-- calls a template in gslib.xsl in order to avoid xsl vs xslt issue -->
     287    <!--<xsl:template match="gsf:equivlinkgs3">
    253288    <xslt:call-template name="equivDocLinks">
    254289      <xslt:with-param name="count" select="0"/>
     
    256291  </xsl:template>-->
    257292
    258   <!-- Another way (also works with DSpace tutorial): build all the equivalent document links for the current document in one go. No looping necessary: handled in function call. -->
    259   <xsl:template match="gsf:equivlinkgs3" name="gsf:equivlinkgs3">
    260     <xslt:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
    261     <xslt:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>   
    262     <xslt:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
    263 
    264     <xslt:variable name="equivDocLinks" select="java:org.greenstone.gsdl3.util.XSLTUtil.getEquivDocLinks(',',$docicon, $docStartlink, $docEndlink, ' ')" />
    265     <xslt:value-of disable-output-escaping="yes" select="$equivDocLinks"/>
    266   </xsl:template>
    267 
    268 <!--
     293    <!-- Another way (also works with DSpace tutorial): build all the equivalent document links for the current document in one go. No looping necessary: handled in function call. -->
     294    <xsl:template match="gsf:equivlinkgs3" name="gsf:equivlinkgs3">
     295        <xslt:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
     296        <xslt:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>   
     297        <xslt:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
     298
     299        <xslt:variable name="equivDocLinks" select="java:org.greenstone.gsdl3.util.XSLTUtil.getEquivDocLinks(',',$docicon, $docStartlink, $docEndlink, ' ')" />
     300        <xslt:value-of disable-output-escaping="yes" select="$equivDocLinks"/>
     301    </xsl:template>
     302
     303    <!--
    269304In the collection's format statement, could have the following javascript+XSLT in place of
    270305the gsf:equivlinkgs3 element (which resolves to the XSLT in config_format.xsl and gslib.xsl).
     
    292327      If the requested string occurs in neither, the request string itself will be output. -->
    293328    <xsl:template match="gsf:displayText">
    294       <xslt:variable name="displaytext">
    295         <xsl:call-template name="gsf:displayItem"/>
    296       </xslt:variable>
    297 
    298       <xslt:choose>
    299         <xslt:when test="$displaytext != ''">
    300           <xslt:value-of disable-output-escaping="yes" select="$displaytext"/>       
    301         </xslt:when>
    302         <xslt:otherwise>
    303           <xslt:variable name="interfacetxt">
    304         <xsl:call-template name="gsf:interfaceText"/>
    305           </xslt:variable>
    306 
    307           <xslt:choose>
    308         <xslt:when test="$interfacetxt != ''">
    309           <xslt:value-of disable-output-escaping="yes" select="$interfacetxt"/>
    310         </xslt:when>
    311         <xslt:otherwise>
    312           <xslt:value-of disable-output-escaping="yes" select="'{@name}'"/>
    313         </xslt:otherwise>
    314           </xslt:choose>
    315         </xslt:otherwise>
    316       </xslt:choose>
     329        <xslt:variable name="displaytext">
     330            <xsl:call-template name="gsf:displayItem"/>
     331        </xslt:variable>
     332
     333        <xslt:choose>
     334            <xslt:when test="$displaytext != ''">
     335                <xslt:value-of disable-output-escaping="yes" select="$displaytext"/>         
     336            </xslt:when>
     337            <xslt:otherwise>
     338                <xslt:variable name="interfacetxt">
     339                    <xsl:call-template name="gsf:interfaceText"/>
     340                </xslt:variable>
     341
     342                <xslt:choose>
     343                    <xslt:when test="$interfacetxt != ''">
     344                        <xslt:value-of disable-output-escaping="yes" select="$interfacetxt"/>
     345                    </xslt:when>
     346                    <xslt:otherwise>
     347                        <xslt:value-of disable-output-escaping="yes" select="'{@name}'"/>
     348                    </xslt:otherwise>
     349                </xslt:choose>
     350            </xslt:otherwise>
     351        </xslt:choose>
    317352    </xsl:template>
    318353
    319354    <!-- With gsf:displayItem, a user can request a displayItem from collectionConfig.xml -->
    320355    <xsl:template match="gsf:displayItem" name="gsf:displayItem">
    321       <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/displayItem[@name='{@name}']"/>
     356        <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/displayItem[@name='{@name}']"/>
    322357    </xsl:template>
    323358
    324359    <!-- With gsf:interfaceText, a user can request a string from the interface dictionaries in the current lang -->
    325360    <xsl:template match="gsf:interfaceText" name="gsf:interfaceText">
    326       <xslt:value-of disable-output-escaping="yes" select="util:getInterfaceText($interface_name, /page/@lang, '{@name}')"/>
     361        <xslt:value-of disable-output-escaping="yes" select="util:getInterfaceText($interface_name, /page/@lang, '{@name}')"/>
    327362    </xsl:template>
    328363    <!-- With gsf:collectionText, a user can request a string from the collection's dictionary in the current lang -->
    329364    <xsl:template match="gsf:collectionText" name="gsf:collectionText">
    330     <xslt:variable name="collName" select="/page/pageResponse/collection/@name"/>
     365        <xslt:variable name="collName" select="/page/pageResponse/collection/@name"/>
    331366        <xslt:copy-of select="util:getCollectionText($collName, $site_name, /page/@lang, '{@name}', '{@args}')/node()"/>
    332367    </xsl:template>
     
    336371        <xsl:if test="not(@hidden = 'true')">
    337372            <!-- set hidden=true on a gsf:metadata so that it gets retrieved from the server but not displayed -->
    338             <xsl:variable name="meta_name"><xsl:call-template name="getMetadataName"/></xsl:variable>
     373            <xsl:variable name="meta_name">
     374                <xsl:call-template name="getMetadataName"/>
     375            </xsl:variable>
    339376            <xsl:variable name="separator">
    340377                <xsl:choose>
    341                     <xsl:when test="@separator"><xsl:value-of disable-output-escaping='yes' select="@separator"/></xsl:when>
    342                     <xsl:when test="separator"><xsl:copy-of select="separator/node()"/></xsl:when>
    343                     <xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise>
     378                    <xsl:when test="@separator">
     379                        <xsl:value-of disable-output-escaping='yes' select="@separator"/>
     380                    </xsl:when>
     381                    <xsl:when test="separator">
     382                        <xsl:copy-of select="separator/node()"/>
     383                    </xsl:when>
     384                    <xsl:otherwise>
     385                        <xsl:text>, </xsl:text>
     386                    </xsl:otherwise>
    344387                </xsl:choose>
    345388            </xsl:variable>
    346389            <xsl:variable name="prefix">
    347390                <xsl:choose>
    348                     <xsl:when test="@prefix"><xsl:value-of disable-output-escaping='yes' select="@prefix"/></xsl:when>
    349                     <xsl:when test="prefix"><xsl:copy-of select="prefix/node()"/></xsl:when>
     391                    <xsl:when test="@prefix">
     392                        <xsl:value-of disable-output-escaping='yes' select="@prefix"/>
     393                    </xsl:when>
     394                    <xsl:when test="prefix">
     395                        <xsl:copy-of select="prefix/node()"/>
     396                    </xsl:when>
    350397                </xsl:choose>
    351398            </xsl:variable>
    352399            <xsl:variable name="suffix">
    353400                <xsl:choose>
    354                     <xsl:when test="@suffix"><xsl:value-of disable-output-escaping='yes' select="@suffix"/></xsl:when>
    355                     <xsl:when test="suffix"><xsl:copy-of select="suffix/node()"/></xsl:when>
     401                    <xsl:when test="@suffix">
     402                        <xsl:value-of disable-output-escaping='yes' select="@suffix"/>
     403                    </xsl:when>
     404                    <xsl:when test="suffix">
     405                        <xsl:copy-of select="suffix/node()"/>
     406                    </xsl:when>
    356407                </xsl:choose>
    357408            </xsl:variable>
     
    360411                    <xsl:when test="@pos = 'first'">position()=1</xsl:when>
    361412                    <xsl:when test="@pos = 'last'">position() = last()</xsl:when>
    362                     <xsl:when test="@pos">position() = <xsl:value-of select="@pos"/></xsl:when>
     413                    <xsl:when test="@pos">position() = <xsl:value-of select="@pos"/>
     414                    </xsl:when>
    363415                    <xsl:otherwise>true()</xsl:otherwise>
    364416                </xsl:choose>
     
    372424            <xslt:for-each>
    373425                <xsl:attribute name="select">
    374                     <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>
     426                    <xsl:if test="@type='collection'">/page/pageResponse/collection/</xsl:if>(.//metadataList)[last()]/metadata[@name='<xsl:value-of select="$meta_name"/>'<xsl:if test="@lang">
     427                        <xsl:text> and @lang=</xsl:text>
     428                        <xsl:value-of select="@lang"/>
     429                    </xsl:if>
     430                    <xsl:text>]</xsl:text>
    375431                </xsl:attribute>
    376432                <xslt:if test="{$postest}">
    377                     <xslt:if test="{$multiple} and position()>1"><xsl:copy-of select="$separator"/></xslt:if>
     433                    <xslt:if test="{$multiple} and position()>1"><xsl:copy-of select="$separator"/>
     434                    </xslt:if>
    378435                    <xsl:copy-of select="$prefix"/>
    379436                    <xsl:choose>
     
    391448    </xsl:template>
    392449
    393   <xsl:template name="getMetadataName">
    394     <xsl:if test='@select'>
    395       <xsl:value-of select='@select'/>
    396       <xsl:text>_</xsl:text>
    397     </xsl:if>
    398     <xsl:value-of select="@name"/>
    399   </xsl:template>
     450    <xsl:template name="getMetadataName">
     451        <xsl:if test='@select'>
     452            <xsl:value-of select='@select'/>
     453            <xsl:text>_</xsl:text>
     454        </xsl:if>
     455        <xsl:value-of select="@name"/>
     456    </xsl:template>
    400457
    401458    <xsl:template match="gsf:text">
    402459        <xslt:call-template name="documentNodeText"/>
    403460    </xsl:template>
    404  
    405   <xsl:template match="gsf:if-metadata-exists">
    406     <xsl:variable name="meta-path"><xsl:for-each select="gsf:metadata">(.//metadataList)[last()]/metadata[@name='<xsl:call-template name="getMetadataName"/>']</xsl:for-each></xsl:variable>
    407     <xslt:choose>
    408     <xslt:when test="{$meta-path}">
    409       <xsl:apply-templates select="gsf:if/node()"/>
    410     </xslt:when>
    411       <xsl:if test="gsf:else">
    412     <xslt:otherwise><xsl:apply-templates select="gsf:else/node()"/>
    413     </xslt:otherwise>
    414       </xsl:if>
    415     </xslt:choose>
    416   </xsl:template>
     461
     462    <xsl:template match="gsf:if-metadata-exists">
     463        <xsl:variable name="meta-path">
     464            <xsl:for-each select="gsf:metadata">(.//metadataList)[last()]/metadata[@name='<xsl:call-template name="getMetadataName"/>']</xsl:for-each>
     465        </xsl:variable>
     466        <xslt:choose>
     467            <xslt:when test="{$meta-path}">
     468                <xsl:apply-templates select="gsf:if/node()"/>
     469            </xslt:when>
     470            <xsl:if test="gsf:else">
     471                <xslt:otherwise>
     472                    <xsl:apply-templates select="gsf:else/node()"/>
     473                </xslt:otherwise>
     474            </xsl:if>
     475        </xslt:choose>
     476    </xsl:template>
    417477
    418478    <xsl:template match="gsf:choose-metadata">
     
    425485            </xsl:for-each>
    426486            <xsl:if test="gsf:default">
    427                 <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
     487                <xslt:otherwise>
     488                    <xsl:apply-templates select="gsf:default"/>
     489                </xslt:otherwise>
    428490            </xsl:if>
    429491        </xslt:choose>
    430492    </xsl:template>
    431  
     493
    432494    <xsl:template match="gsf:switch">
    433         <xsl:variable name="meta-name"><xsl:for-each select="gsf:metadata"><xsl:call-template name="getMetadataName"/></xsl:for-each></xsl:variable>
    434         <xslt:variable name="meta"><xsl:choose><xsl:when test="@preprocess"><xslt:value-of select="util:{@preprocess}((.//metadataList)[last()]/metadata[@name='{$meta-name}'], /page/@lang )"/></xsl:when><xsl:otherwise><xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$meta-name}']"/></xsl:otherwise></xsl:choose></xslt:variable>
     495        <xsl:variable name="meta-name">
     496            <xsl:for-each select="gsf:metadata">
     497                <xsl:call-template name="getMetadataName"/>
     498            </xsl:for-each>
     499        </xsl:variable>
     500        <xslt:variable name="meta">
     501            <xsl:choose>
     502                <xsl:when test="@preprocess">
     503                    <xslt:value-of select="util:{@preprocess}((.//metadataList)[last()]/metadata[@name='{$meta-name}'], /page/@lang )"/>
     504                </xsl:when>
     505                <xsl:otherwise>
     506                    <xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$meta-name}']"/>
     507                </xsl:otherwise>
     508            </xsl:choose>
     509        </xslt:variable>
    435510        <xslt:choose>
    436511            <xsl:for-each select="gsf:when">
     
    446521        </xslt:choose>
    447522    </xsl:template>
    448  
     523
    449524    <xsl:template match="*">
    450525        <xsl:copy>
    451         <xsl:copy-of select="@*"/>
     526            <xsl:copy-of select="@*"/>
    452527            <xsl:apply-templates/>
    453528        </xsl:copy>
Note: See TracChangeset for help on using the changeset viewer.