Changeset 3133 for metadata


Ignore:
Timestamp:
07/11/13 17:15:41 (11 years ago)
Author:
sanmai
Message:
  • Only show Resources table on top of webpage if there are resources defined in the CMDI.
  • Fix handling of leaf nodes in component trees that are of type xs:float and more generally, numeric, casting them as strings.
  • Fix handling of empty leaf nodes in component trees.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • metadata/trunk/toolkit/xslt/cmdi2xhtml.xsl

    r2069 r3133  
    4343                   
    4444                     <xsl:choose>
    45                          <xsl:when test="$nchildren = 0">
     45                         <xsl:when test="$nchildren = 0 and not(not(child::node()))">
    4646                             <!--<br /><br />-->
    4747                             <div class="Component_tree_node_content">
    48                                  <xsl:variable name="leaf_value" select="self::element()"                       as="xs:string"/>
    49                                  <xsl:variable name="HTTP_URL"   select="starts-with($leaf_value, 'http://')"   as="xs:boolean"/>
    50                                  <code class="leaf">
     48<!--                                 -->
    5149                                 <xsl:choose>
    52                                      <xsl:when test="$HTTP_URL">
    53                                          <a href="{$leaf_value}"><xsl:value-of select="$leaf_value"/></a>
     50                                     <xsl:when test="self::element() castable as xs:string">
     51                                        <xsl:variable name="leaf_value"
     52                                                      select="self::element() cast as xs:string"
     53                                                      as="xs:string"/>
     54                                         
     55                                         <xsl:variable name="HTTP_URL"
     56                                             select="starts-with($leaf_value, 'http://')"   as="xs:boolean"/>
     57                                         <code class="leaf">
     58                                             <xsl:choose>
     59                                                 <xsl:when test="$HTTP_URL">
     60                                                     <a href="{$leaf_value}"><xsl:value-of select="$leaf_value"/></a>
     61                                                 </xsl:when>
     62                                                 <xsl:otherwise>                                   
     63                                                     <xsl:value-of select="$leaf_value"/>                                         
     64                                                 </xsl:otherwise>                                 
     65                                             </xsl:choose>
     66                                         </code>
    5467                                     </xsl:when>
    55                                      <xsl:otherwise>                                   
    56                                              <xsl:value-of select="$leaf_value"/>                                         
    57                                      </xsl:otherwise>                                 
     68                                     <xsl:otherwise>
     69                                         <xsl:variable name="leaf_value"
     70                                                       select="format-number(self::element(), '#') cast as xs:string"
     71                                                       as="xs:string"/>
     72                                         
     73                                         <xsl:variable name="HTTP_URL"
     74                                             select="starts-with($leaf_value, 'http://')"   as="xs:boolean"/>
     75                                         <code class="leaf">
     76                                             <xsl:choose>
     77                                                 <xsl:when test="$HTTP_URL">
     78                                                     <a href="{$leaf_value}"><xsl:value-of select="$leaf_value"/></a>
     79                                                 </xsl:when>
     80                                                 <xsl:otherwise>                                   
     81                                                     <xsl:value-of select="$leaf_value"/>                                         
     82                                                 </xsl:otherwise>                                 
     83                                             </xsl:choose>
     84                                         </code>
     85                                     </xsl:otherwise>
    5886                                 </xsl:choose>
    59                                  </code>
    6087                             </div>
    6188                         </xsl:when>
     
    6390                             <ul>
    6491                                 <xsl:call-template name="Component_tree">
    65                                      <xsl:with-param name="nodeset" select="self::element()"/>
     92                                     <xsl:with-param name="nodeset"
     93                                                     select="self::element()"/>
    6694                                 </xsl:call-template>
    6795                             </ul>
     
    80108            <meta charset="utf-8"/>
    81109            <head>
    82                 <title>CMDI collection "<xsl:value-of select="./Header/MdCollectionDisplayName" xmlns="cmd"/>"
    83                 </title>
    84                     <link rel="stylesheet" type="text/css" href="http://catalog.clarin.eu/ds/vlo/css/main.css"/>
     110                <title>CMDI collection "<xsl:value-of select="./Header/MdCollectionDisplayName" xmlns="cmd"/>"</title>
     111                <link rel="stylesheet" type="text/css" href="http://catalog.clarin.eu/ds/vlo/css/main.css"></link>
    85112             
    86113                <style media="screen" type="text/css">
     
    140167                <article>
    141168                    <div class="endgame">
     169                        <xsl:if test="not(not(Resources/*[normalize-space()]))">
    142170                        <p>
    143171                            <h1>Resources</h1>
     
    184212                            </table>
    185213                        </p>
     214                       </xsl:if>
    186215                    </div>
    187216
Note: See TracChangeset for help on using the changeset viewer.