Changeset 4259


Ignore:
Timestamp:
01/13/14 16:01:59 (10 years ago)
Author:
twagoo
Message:

Removed html header from output of cmdi2xhtml stylesheet.
Moved its CSS into separate file (included in header of showresultpage).

Location:
vlo/branches/to-wicket-1.6/vlo_web_app/src/main
Files:
1 added
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.html

    r4249 r4259  
    5454            <div wicket:id="completeCmdiContainer" id="completeCmdiView">
    5555                <a wicket:id="toggleCmdiView"><span style="font-weight: bold;" wicket:id="toggleLabel">[toggle cmdi view]</span></a>
    56                 <span id="completeCmdi" wicket:id="completeCmdi"></span>
     56                <div id="completeCmdi" wicket:id="completeCmdi"></div>
    5757            </div>                     
    5858            <br>
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java

    r4255 r4259  
    4343import org.apache.wicket.markup.ComponentTag;
    4444import org.apache.wicket.markup.MarkupStream;
     45import org.apache.wicket.markup.head.CssHeaderItem;
     46import org.apache.wicket.markup.head.IHeaderResponse;
    4547import org.apache.wicket.markup.html.WebMarkupContainer;
    4648import org.apache.wicket.markup.html.basic.Label;
     
    5557import org.apache.wicket.request.Url;
    5658import org.apache.wicket.request.cycle.RequestCycle;
     59import org.apache.wicket.request.resource.PackageResourceReference;
     60import org.apache.wicket.request.resource.ResourceReference;
    5761import org.apache.wicket.util.encoding.UrlDecoder;
    5862import org.apache.wicket.util.encoding.UrlEncoder;
     
    7175    public static final String feedbackfromURL = VloConfig.getFeedbackFromUrl();
    7276
    73     private final URL xslFile = getClass().getResource("/cmdi2xhtml.xsl");
     77    private final URL xslFile = getClass().getResource("/eu/clarin/cmdi/vlo/pages/cmdi2xhtml.xsl");
     78    private final ResourceReference XSL_CSS_REFERENCE = new PackageResourceReference(getClass(), "cmdi.css");
    7479
    7580    @SuppressWarnings("serial")
     
    573578            trans.transform();
    574579        } catch (Exception e) {
    575             LOG.error("Couldn't create CMDI metadata: " + e.getMessage());
     580            LOG.error("Couldn't create CMDI metadata: ", e);
    576581            strWriter = new StringWriter().append("<b>Could not load complete CMDI metadata</b>");
    577582        }
     
    580585        completeCmdiLabel.setEscapeModelStrings(false);
    581586    }
     587
     588    @Override
     589    public void renderHead(IHeaderResponse response) {
     590        super.renderHead(response);
     591        response.render(CssHeaderItem.forReference(XSL_CSS_REFERENCE));
     592    }
    582593}
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/resources/eu/clarin/cmdi/vlo/pages/cmdi2xhtml.xsl

    r4258 r4259  
    4343                        name="nchildren"
    4444                        select="fn:count(child::element())"/>
    45                      <li>
     45                    <li>
    4646                     
    47                      <code class="node">
    48                          <xsl:value-of
    49                              select="fn:concat(local-name(), ' ')"/>
    50                          <xsl:if
    51                              test="count(@*) > 0">
    52                              <div class="attributes">
    53                                  <xsl:for-each
    54                                      select="@*">
    55                                      <xsl:value-of
    56                                          select="name()"/>="<xsl:value-of select="."/>"
    57                                  </xsl:for-each>
    58                              </div>
    59                          </xsl:if>
    60                      </code>
     47                        <code class="node">
     48                            <xsl:value-of
     49                                select="fn:concat(local-name(), ' ')"/>
     50                            <xsl:if
     51                                test="count(@*) > 0">
     52                                <div class="attributes">
     53                                    <xsl:for-each
     54                                        select="@*">
     55                                        <xsl:value-of
     56                                            select="name()"/>="<xsl:value-of select="."/>"
     57                                    </xsl:for-each>
     58                                </div>
     59                            </xsl:if>
     60                        </code>
    6161                   
    62                      <xsl:choose>
    63                          <xsl:when
    64                              test="$nchildren = 0 and not(not(child::node()))">
    65                              <!--<br /><br />-->
    66                              <div class="Component_tree_node_content">
    67                                 <xsl:choose>
    68                                     <xsl:when
    69                                         test="self::element() castable as xs:string">
    70                                         <xsl:variable
    71                                             name="leaf_value"
    72                                             select="self::element() cast as xs:string"
    73                                             as="xs:string"/>                                         
    74                                         <xsl:variable
    75                                             name="is_URL"
    76                                             select="starts-with($leaf_value, 'http://') or starts-with($leaf_value, 'https://')"
    77                                             as="xs:boolean"/>
    78                                         <code class="leaf">
    79                                             <xsl:choose>
    80                                                 <xsl:when
    81                                                     test="$is_URL">
    82                                                     <a href="{$leaf_value}">
     62                        <xsl:choose>
     63                            <xsl:when
     64                                test="$nchildren = 0 and not(not(child::node()))">
     65                                <!--<br /><br />-->
     66                                <div class="Component_tree_node_content">
     67                                    <xsl:choose>
     68                                        <xsl:when
     69                                            test="self::element() castable as xs:string">
     70                                            <xsl:variable
     71                                                name="leaf_value"
     72                                                select="self::element() cast as xs:string"
     73                                                as="xs:string"/>                                         
     74                                            <xsl:variable
     75                                                name="is_URL"
     76                                                select="starts-with($leaf_value, 'http://') or starts-with($leaf_value, 'https://')"
     77                                                as="xs:boolean"/>
     78                                            <code class="leaf">
     79                                                <xsl:choose>
     80                                                    <xsl:when
     81                                                        test="$is_URL">
     82                                                        <a href="{$leaf_value}">
     83                                                            <xsl:value-of
     84                                                                select="$leaf_value"/>
     85                                                        </a>
     86                                                    </xsl:when>
     87                                                    <xsl:otherwise>                                   
    8388                                                        <xsl:value-of
    84                                                             select="$leaf_value"/>
    85                                                     </a>
    86                                                 </xsl:when>
    87                                                 <xsl:otherwise>                                   
    88                                                     <xsl:value-of
    89                                                         select="$leaf_value"/>                                         
    90                                                 </xsl:otherwise>                                 
    91                                             </xsl:choose>
    92                                         </code>
    93                                     </xsl:when>
    94                                     <xsl:otherwise>                                   
    95                                         <xsl:variable
    96                                             name="leaf_value"
    97                                             select="format-number(self::element(), '#') cast as xs:string"
    98                                             as="xs:string"/>
    99                                         <xsl:variable
    100                                             name="is_URL"
    101                                             select="starts-with($leaf_value, 'http://') or starts-with($leaf_value, 'https://')"
    102                                             as="xs:boolean"/>
    103                                         <code class="leaf">
    104                                             <xsl:choose>
    105                                                 <xsl:when
    106                                                     test="$is_URL">
     89                                                            select="$leaf_value"/>                                         
     90                                                    </xsl:otherwise>                                 
     91                                                </xsl:choose>
     92                                            </code>
     93                                        </xsl:when>
     94                                        <xsl:otherwise>                                   
     95                                            <xsl:variable
     96                                                name="leaf_value"
     97                                                select="format-number(self::element(), '#') cast as xs:string"
     98                                                as="xs:string"/>
     99                                            <xsl:variable
     100                                                name="is_URL"
     101                                                select="starts-with($leaf_value, 'http://') or starts-with($leaf_value, 'https://')"
     102                                                as="xs:boolean"/>
     103                                            <code class="leaf">
     104                                                <xsl:choose>
     105                                                    <xsl:when
     106                                                        test="$is_URL">
    107107                                                    <a href="{$leaf_value}"><xsl:value-of select="$leaf_value"/></a>
    108                                                 </xsl:when>
    109                                                 <xsl:otherwise>                                   
    110                                                     <xsl:value-of
    111                                                         select="$leaf_value"/>                                         
    112                                                 </xsl:otherwise>                                 
    113                                             </xsl:choose>
    114                                         </code>                 
    115                                     </xsl:otherwise>                                 
    116                                 </xsl:choose>
    117                              </div>
    118                          </xsl:when>
    119                          <xsl:otherwise>
    120                              <ul>
    121                                  <xsl:call-template
    122                                      name="Component_tree">
    123                                      <xsl:with-param
    124                                          name="nodeset"
    125                                          select="self::element()"/>
    126                                  </xsl:call-template>
    127                              </ul>
    128                          </xsl:otherwise>
    129                      </xsl:choose>
     108                                                    </xsl:when>
     109                                                    <xsl:otherwise>                                   
     110                                                        <xsl:value-of
     111                                                            select="$leaf_value"/>                                         
     112                                                    </xsl:otherwise>                                 
     113                                                </xsl:choose>
     114                                            </code>                 
     115                                        </xsl:otherwise>                                 
     116                                    </xsl:choose>
     117                                </div>
     118                            </xsl:when>
     119                            <xsl:otherwise>
     120                                <ul>
     121                                    <xsl:call-template
     122                                        name="Component_tree">
     123                                        <xsl:with-param
     124                                            name="nodeset"
     125                                            select="self::element()"/>
     126                                    </xsl:call-template>
     127                                </ul>
     128                            </xsl:otherwise>
     129                        </xsl:choose>
    130130                                     
    131131                    </li>                               
     
    136136
    137137    <xsl:template match="CMD">
    138         <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    139             <meta charset="utf-8"/>
    140             <head>
    141                 <title>CMDI collection "<xsl:value-of select="./Header/MdCollectionDisplayName" xmlns="cmd"/>"</title>
    142                 <link rel="stylesheet" type="text/css" href="http://catalog.clarin.eu/ds/vlo/css/main.css"></link>
    143                
    144                 <style media="screen" type="text/css">
    145                     <![CDATA[
    146                     li
    147                     {
    148                         margin: 20px;
    149                         margin-left: -1.2em;
    150                     }
     138        <article style="background-color:#EEEEEE">
     139            <div class="endgame">
     140                <xsl:if test="not(not(Resources/*[normalize-space()]))">
     141                    <p>                   
     142                        <h1>Resources</h1>
     143                        <table>
     144                            <caption>Resources</caption>
     145                            <thead>
     146                                <tr>
     147                                    <th class="attribute">Reference to resource</th>
     148                                    <th class="attribute">Resource description</th>
     149                                    <th class="attribute">Resource MIME type</th>
     150                                    <th class="attribute">Resource Proxy ID</th>
     151                                </tr>
     152                            </thead>
     153                            <tbody class="attributesTbody">
     154                                <xsl:for-each
     155                                    select="Resources/ResourceProxyList/ResourceProxy">
     156                                    <xsl:variable
     157                                        name="URI"
     158                                        select="ResourceRef/text()"
     159                                        as="xs:string"/>
     160                                    <tr>
     161                                        <td class="attributeValue">                                               
     162                                            <xsl:variable
     163                                                name="protocol"
     164                                                select="fn:substring-before($URI, ':')"
     165                                                as="xs:string"/>
     166                                            <xsl:choose>
     167                                                <xsl:when
     168                                                    test="$protocol = 'hdl'">
     169                                                    <xsl:variable
     170                                                        name="HANDLE_PREFIX"
     171                                                        select="'http://hdl.handle.net'"
     172                                                        as="xs:string"/>                                               
     173                                                    <xsl:variable
     174                                                        name="Handle_reference"
     175                                                        select="fn:substring-after($URI, ':')"
     176                                                        as="xs:string"/>
     177                                                    <xsl:variable
     178                                                        name="Handle_HTTP_URL"
     179                                                        select="fn:concat($HANDLE_PREFIX, '/', $Handle_reference)"
     180                                                        as="xs:string"/>
     181                                                    <a href="{$Handle_HTTP_URL}">
     182                                                        <xsl:value-of
     183                                                            select="$Handle_HTTP_URL"/>
     184                                                    </a>
     185                                                </xsl:when>
     186                                                <xsl:otherwise>
     187                                                    <a href="{ResourceRef}">
     188                                                        <xsl:value-of
     189                                                            select="ResourceRef"/>
     190                                                    </a>
     191                                                </xsl:otherwise>
     192                                            </xsl:choose>                                               
     193                                        </td>
     194                                        <td class="attributeValue">
     195                                            <xsl:value-of select="ResourceType"/>
     196                                        </td>
     197                                        <td class="attributeValue">
     198                                            <xsl:value-of select="ResourceType/@mimetype"/>
     199                                        </td>
     200                                        <td class="attributeValue">
     201                                            <xsl:value-of select="./@id"/>
     202                                        </td>
     203                                    </tr>
     204                                </xsl:for-each>
     205                            </tbody>
     206                        </table>
     207                    </p>
     208                </xsl:if>
     209            </div>
    151210                   
    152                     .node
    153                     {
    154                         background-color: rgba(188, 205, 232, 0.8);
    155                         border: 1px ridge;
    156                         font-weight: bold;
    157                         padding: 5px;
    158                         /*float: left;*/
    159                     }                   
    160                    
    161                     .leaf
    162                     {
    163                     }                   
    164                    
    165                     .Component_tree_node_content
    166                     {
    167                         background-color: rgba(188, 200, 232, 0.3);
    168                         border: 1px dotted red;                       
    169                         margin-top: 10px;
    170                         margin-left: 10px;
    171                         padding: 5px;
    172                         display: inline-block;
    173                         /*float: left;*/       
    174                         /*display: table-cell;*/
    175                     }                   
    176                    
    177                     .attributes
    178                     {                       
    179                         display: inline-block;
    180                         font-style: italic;
    181                         font-weight: normal;
    182                         /*background-color: rgba(100, 201, 234, 0.4);*/
    183                     }
    184                    
    185                     footer
    186                     {
    187                         border: 1px dotted;
    188                     }                   
    189                    
    190                     address
    191                     {
    192                         display: inline-block;
    193                     }
    194                    
    195                     .searchword { background-color: yellow; }
    196                     ]]>
    197                 </style>
    198             </head>
    199             <body>
    200                 <article style="background-color:#EEEEEE">
    201                     <div class="endgame">
    202                         <xsl:if test="not(not(Resources/*[normalize-space()]))">
    203                             <p>                   
    204                                 <h1>Resources</h1>
    205                                 <table>
    206                                  <caption>Resources</caption>
    207                                  <thead>
    208                                      <tr>
    209                                          <th class="attribute">Reference to resource</th>
    210                                          <th class="attribute">Resource description</th>
    211                                          <th class="attribute">Resource MIME type</th>
    212                                          <th class="attribute">Resource Proxy ID</th>
    213                                      </tr>
    214                                  </thead>
    215                                  <tbody class="attributesTbody">
    216                                      <xsl:for-each
    217                                          select="Resources/ResourceProxyList/ResourceProxy">
    218                                          <xsl:variable
    219                                              name="URI"
    220                                              select="ResourceRef/text()"
    221                                              as="xs:string"/>
    222                                          <tr>
    223                                              <td class="attributeValue">                                               
    224                                                  <xsl:variable
    225                                                      name="protocol"
    226                                                      select="fn:substring-before($URI, ':')"
    227                                                      as="xs:string"/>
    228                                                  <xsl:choose>
    229                                                      <xsl:when
    230                                                          test="$protocol = 'hdl'">
    231                                                          <xsl:variable
    232                                                              name="HANDLE_PREFIX"
    233                                                              select="'http://hdl.handle.net'"
    234                                                              as="xs:string"/>                                               
    235                                                          <xsl:variable
    236                                                              name="Handle_reference"
    237                                                              select="fn:substring-after($URI, ':')"
    238                                                              as="xs:string"/>
    239                                                          <xsl:variable
    240                                                              name="Handle_HTTP_URL"
    241                                                              select="fn:concat($HANDLE_PREFIX, '/', $Handle_reference)"
    242                                                              as="xs:string"/>
    243                                                          <a href="{$Handle_HTTP_URL}">
    244                                                              <xsl:value-of
    245                                                                 select="$Handle_HTTP_URL"/>
    246                                                          </a>
    247                                                      </xsl:when>
    248                                                      <xsl:otherwise>
    249                                                          <a href="{ResourceRef}">
    250                                                              <xsl:value-of
    251                                                                  select="ResourceRef"/>
    252                                                          </a>
    253                                                      </xsl:otherwise>
    254                                                  </xsl:choose>                                               
    255                                              </td>
    256                                              <td class="attributeValue">
    257                                                  <xsl:value-of select="ResourceType"/>
    258                                              </td>
    259                                              <td class="attributeValue">
    260                                                  <xsl:value-of select="ResourceType/@mimetype"/>
    261                                              </td>
    262                                              <td class="attributeValue">
    263                                                  <xsl:value-of select="./@id"/>
    264                                              </td>
    265                                          </tr>
    266                                      </xsl:for-each>
    267                                  </tbody>
    268                                 </table>
    269                             </p>
    270                         </xsl:if>
    271                     </div>
    272                    
    273                     <p>
    274                         <h1>Metadata content</h1>
    275                         <xsl:call-template name="Component_tree"/>
    276                     </p>
    277                 </article>
    278             </body>
    279         </html>
     211            <p>
     212                <h1>Metadata content</h1>
     213                <xsl:call-template name="Component_tree"/>
     214            </p>
     215        </article>
    280216    </xsl:template>
    281217</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.