3 Licensed to the Apache Software Foundation (ASF) under one or more
4 contributor license agreements. See the NOTICE file distributed with
5 this work for additional information regarding copyright ownership.
6 The ASF licenses this file to You under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with
8 the License. You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
19 site-to-xhtml.xsl is the final stage in HTML page production. It merges HTML from
20 document-to-html.xsl, tab-to-menu.xsl and book-to-menu.xsl, and adds the site header,
21 footer, searchbar, css etc. As input, it takes XML of the form:
36 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
37 xmlns:i18n="http://apache.org/cocoon/i18n/2.1" exclude-result-prefixes="i18n">
38 <xsl:import href="../../../common/xslt/html/site-to-xhtml.xsl"/>
40 |Overall site template
42 <xsl:template match="site">
43 <!--html lang="en" xml:lang="en"-->
52 <!-- Add some Forrest-specific metadata -->
53 <xsl:call-template name="html-meta"/>
54 <!-- Add any metadata from the documents -->
55 <xsl:call-template name="meta-data"/>
59 <title><xsl:value-of select="div[@id='content']/h1"/>
60 <xsl:if test="$config/motd">
61 <xsl:for-each select="$config/motd/motd-option">
63 <xsl:when test="@starts-with='true'">
64 <xsl:if test="starts-with($path, @pattern)">
65 <xsl:if test="normalize-space(motd-title) != ''">
66 <xsl:text> (</xsl:text>
67 <xsl:value-of select="motd-title"/>
68 <xsl:text>)</xsl:text>
73 <xsl:if test="contains($path, @pattern)">
74 <xsl:if test="normalize-space(motd-title) != ''">
75 <xsl:text> (</xsl:text>
76 <xsl:value-of select="motd-title"/>
77 <xsl:text>)</xsl:text>
86 +--><link rel="stylesheet" href="{$root}skin/basic.css" type="text/css"
87 /><link rel="stylesheet" href="{$root}skin/screen.css"
88 type="text/css" media="screen" /><link rel="stylesheet" href="{$root}skin/print.css" type="text/css"
89 media="print" /><link rel="stylesheet" href="{$root}skin/profile.css"
94 <script type="text/javascript" language="javascript"
95 src="{$root}skin/getBlank.js"></script>
96 <script type="text/javascript" language="javascript"
97 src="{$root}skin/getMenu.js"></script>
98 <script type="text/javascript" language="javascript"
99 src="{$root}skin/fontsize.js"></script>
103 <xsl:if test="//skinconfig/favicon-url"><link rel="shortcut icon">
104 <xsl:attribute name="href">
106 select="concat($root,//skinconfig/favicon-url)"/>
107 </xsl:attribute></link>
113 <body onload="init()">
114 <script type="text/javascript">ndeSetTextSize();</script>
116 +++++++++++++++++++++++++++
117 +=========================+
119 +=========================+
124 +=========================+
126 +=========================+
127 +++++++++++++++++++++++++++
130 |topstrip with logos and search box
133 <!--breadcrumbs org location-->
134 <xsl:if test="not ($config/trail/@location)">
138 <div class="breadtrail">
139 <xsl:call-template name="breadcrumbs"/>
149 <xsl:if test="$config/group-url">
150 <div class="grouplogo">
151 <xsl:call-template name="renderlogo">
152 <xsl:with-param name="name" select="$config/group-name"/>
153 <xsl:with-param name="url" select="$config/group-url"/>
154 <xsl:with-param name="logo" select="$config/group-logo"/>
155 <xsl:with-param name="root" select="$root"/>
156 <xsl:with-param name="description" select="$config/group-description"/>
166 <xsl:variable name="xtest">
169 test="$config/group-url and $config/search and not($config/search/@box-location = 'alt')">
170 <xsl:text>true</xsl:text>
173 <xsl:text>false</xsl:text>
177 <div class="projectlogo">
178 <xsl:if test="$xtest='false'" >
179 <xsl:attribute name="class">
180 <xsl:text>projectlogoA1</xsl:text>
183 <xsl:call-template name="renderlogo">
184 <xsl:with-param name="name" select="$config/project-name"/>
185 <xsl:with-param name="url" select="$config/project-url"/>
186 <xsl:with-param name="logo" select="$config/project-logo"/>
187 <xsl:with-param name="root" select="$root"/>
188 <xsl:with-param name="description" select="$config/project-description"/>
195 test="$config/search and not($config/search/@box-location = 'alt')">
199 <div class="searchbox">
200 <xsl:variable name="search-prompt">
201 <i18n:text>Search the site with</i18n:text>
202 <xsl:text> </xsl:text>
203 <xsl:value-of select="$config/search/@provider"/>
206 <xsl:when test="$config/search/@provider = 'lucene'">
207 <!-- Lucene search -->
208 <form method="get" action="{$root}{$lucene-search}">
209 <input type="text" id="query" name="queryString" size="25" onFocus="getBlank (this, '{$search-prompt}');">
210 <xsl:attribute name="value">
211 <xsl:value-of select="$search-prompt"/>
214 <input type="submit" value="Search" name="Search" i18n:attr="value"/>
218 <form class="roundtopsmall" method="get" action="http://search.lucidimagination.com/p:lucene">
219 <input type="text" id="query" name="q" size="25" onFocus="getBlank (this, '{$search-prompt}');">
220 <xsl:attribute name="value">
221 <xsl:value-of select="$search-prompt"/>
224 <input type="submit" value="Search" name="Search" i18n:attr="value"/>
226 <div style="position: relative; top: -5px; left: -10px">Powered by <a style="color: #033268" href="http://www.lucidimagination.com">Lucid Imagination</a></div>
229 <!--div id="roundbottomsmall">
231 src="{$skin-img-dir}/rc-b-l-5-1body-2menu-3menu.png"
232 alt="" width="5" height="5" class="cornersmall"
233 style="display: none" />
243 <xsl:apply-templates select="ul[@id='tabs']"/>
250 |centerstrip with menu and mainarea
253 <div id="publishedStrip">
257 <div id="level2tabs">
258 <xsl:apply-templates select="span[@id='level2tabs']/node()"/>
263 <xsl:call-template name="last-published"/>
268 <div class="breadtrail">
270 <xsl:when test="$config/trail/@location='alt'">
271 <!--breadtrail location='alt'-->
272 <xsl:call-template name="breadcrumbs"/>
275 <!--*NO* breadtrail-->
281 |start Menu, mainarea
283 <xsl:if test="div[@id='menu']/ul/li">
284 <xsl:call-template name="menu"/>
289 <xsl:apply-templates select="div[@id='content']"/>
293 <div class="clearboth"> </div>
296 |bottomstrip with footer
302 <div class="lastmodified">
303 <xsl:call-template name="last-published"/>
305 <xsl:if test="not($config/disable-copyright-footer = 'true')">
306 <div class="copyright">
308 <xsl:text> </xsl:text>
309 <xsl:value-of select="$config/year"/>
310 <xsl:call-template name="current-year">
311 <xsl:with-param name="copyrightyear" select="$config/year"/>
313 <xsl:text> </xsl:text>
315 <xsl:when test="$config/copyright-link"><a>
316 <xsl:attribute name="href">
317 <xsl:value-of select="$config/copyright-link"/>
319 <xsl:value-of select="$config/vendor"/></a>
322 <xsl:value-of select="$config/vendor"/>
327 <xsl:if test="$filename = 'index.html'">
329 <xsl:if test="$config/disable-compliance-links/@align">
330 <xsl:attribute name="style">text-align: <xsl:value-of select="$config/disable-compliance-links/@align"/>
333 <!-- W3C logos style="text-align: center;"-->
334 <xsl:call-template name="compliancy-logos"/>
335 <xsl:if test="$filename = 'index.html' and $config/credits">
336 <xsl:for-each select="$config/credits/credit[not(@role='pdf')]">
337 <xsl:if test="not(@box-location = 'alt') and not(@box-location = 'alt2')">
338 <xsl:variable name="name" select="name"/>
339 <xsl:variable name="url" select="url"/>
340 <xsl:variable name="image" select="image"/>
341 <xsl:variable name="width" select="width"/>
342 <xsl:variable name="height" select="height"/><a href="{$url}">
343 <img alt="{$name} - logo" title="{$name}" border="0">
344 <xsl:attribute name="src">
345 <xsl:if test="not(starts-with($image, 'http://'))">
346 <xsl:value-of select="$root"/>
348 <xsl:value-of select="$image"/>
350 <xsl:attribute name="style">
351 <xsl:if test="$width">width: <xsl:value-of select="$width"/>px;</xsl:if>
352 <xsl:if test="$height">height: <xsl:value-of select="$height"/>px;</xsl:if>
360 <xsl:if test="$config/host-logo and not($config/host-logo = '')">
362 <xsl:call-template name="renderlogo">
363 <xsl:with-param name="name" select="$config/host-name"/>
364 <xsl:with-param name="url" select="$config/host-url"/>
365 <xsl:with-param name="logo" select="$config/host-logo"/>
366 <xsl:with-param name="root" select="$root"/>
370 <xsl:if test="$config/feedback">
371 <xsl:call-template name="feedback"/>
380 <xsl:template name="last-published">
381 <script type="text/javascript"><![CDATA[<!--
382 document.write("]]><i18n:text >Last Published:</i18n:text><![CDATA[ " + document.lastModified);
386 <xsl:template match="div[@class = 'skinconf-heading-1']">
388 <xsl:when test="//skinconfig/headings/@type='underlined'">
389 <h2 class="underlined_10">
390 <xsl:value-of select="h1"/>
393 <xsl:when test="//skinconfig/headings/@type='boxed'">
395 <xsl:value-of select="h1"/>
400 <xsl:value-of select="h1"/>
405 <xsl:template match="div[@class = 'skinconf-heading-2']">
407 <xsl:when test="//skinconfig/headings/@type='underlined'">
408 <h3 class="underlined_5">
409 <xsl:value-of select="h2"/>
412 <xsl:when test="//skinconfig/headings/@type='boxed'">
414 <xsl:value-of select="h2"/>
419 <xsl:value-of select="h2"/>
424 <!-- Add links to any standards-compliance logos -->
425 <xsl:template name="compliancy-logos">
426 <xsl:if test="$filename = 'index.html' and $config/disable-compliance-links = 'false'"><a href="http://validator.w3.org/check/referer">
427 <img class="logoImage"
428 src="{$skin-img-dir}/valid-html401.png"
429 alt="Valid HTML 4.01!" title="Valid HTML 4.01!" style="height: 31px; width: 88px;" /></a><a href="http://jigsaw.w3.org/css-validator/check/referer">
430 <img class="logoImage"
431 src="{$skin-img-dir}/vcss.png"
432 alt="Valid CSS!" title="Valid CSS!" style="height: 31px; width: 88px;"/></a>
435 <xsl:template name="menu">
441 <xsl:for-each select = "div[@id='menu']/ul/li">
442 <xsl:call-template name = "innermenuli" >
443 <xsl:with-param name="id" select="concat('1.', position())"/>
447 <xsl:apply-templates select="div[@id='menu']/*" />
449 <!-- Search box: alternative location -->
451 test="$config/search and $config/search/@box-location='alt'">
455 <div class="searchbox">
457 <xsl:variable name="search-prompt">
458 <i18n:text>Search the site with</i18n:text>
459 <xsl:text> </xsl:text>
460 <xsl:value-of select="$config/search/@provider"/>
463 <xsl:when test="$config/search/@provider = 'lucene'">
464 <!-- Lucene search -->
465 <form method="get" action="{$root}{$lucene-search}">
466 <input type="text" id="query" name="queryString" size="18" onFocus="getBlank (this, '{$search-prompt}');">
467 <xsl:attribute name="value">
468 <xsl:value-of select="$search-prompt"/>
471 <input type="submit" value="Search" name="Search" i18n:attr="value"/>
475 <form class="roundtopsmall" method="get" action="http://search.lucidimagination.com/p:lucene">
476 <input type="text" id="query" name="q" size="25" onFocus="getBlank (this, '{$search-prompt}');">
477 <xsl:attribute name="value">
478 <xsl:value-of select="$search-prompt"/>
481 <input type="submit" value="Search" name="Search" i18n:attr="value"/>
490 <!--credits in alternative location-->
492 <xsl:if test="$filename = 'index.html' and $config/credits and ($config/credits/credit/@box-location = 'alt')">
494 <xsl:for-each select="$config/credits/credit[not(@role='pdf')]">
495 <xsl:if test="@box-location = 'alt'">
496 <xsl:variable name="name" select="name"/>
497 <xsl:variable name="url" select="url"/>
498 <xsl:variable name="image" select="image"/>
499 <xsl:variable name="width" select="width"/>
500 <xsl:variable name="height" select="height"/><a href="{$url}">
501 <img alt="{$name} - logo" title="{$name}" border="0">
502 <xsl:attribute name="src">
503 <xsl:if test="not(starts-with($image, 'http://'))">
504 <xsl:value-of select="$root"/>
506 <xsl:value-of select="$image"/>
508 <xsl:attribute name="style">
509 <xsl:if test="$width">width: <xsl:value-of select="$width"/>px;</xsl:if>
510 <xsl:if test="$height">height: <xsl:value-of select="$height"/>px;</xsl:if>
516 <!-- Message of the day -->
517 <xsl:if test="$config/motd">
518 <xsl:for-each select="$config/motd/motd-option">
520 <xsl:when test="@starts-with='true'">
521 <xsl:if test="starts-with($path, @pattern)">
522 <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'">
524 <xsl:value-of select="motd-page"/>
525 <xsl:if test="motd-page-url">
526 <xsl:text> (</xsl:text><a>
527 <xsl:attribute name="href">
528 <xsl:value-of select="motd-page-url"/>
530 <xsl:text>More</xsl:text></a>
531 <xsl:text>)</xsl:text>
537 <xsl:if test="contains($path, @pattern)">
538 <xsl:if test="motd-page/@location='alt' or motd-page/@location='both'">
540 <xsl:value-of select="motd-page"/>
541 <xsl:if test="motd-page-url">
542 <xsl:text> (</xsl:text><a>
543 <xsl:attribute name="href">
544 <xsl:value-of select="motd-page-url"/>
546 <xsl:text>More</xsl:text></a>
547 <xsl:text>)</xsl:text>
556 <div id="roundbottom">
558 src="{$skin-img-dir}/rc-b-l-15-1body-2menu-3menu.png"
559 alt="" width="15" height="15" class="corner"
560 style="display: none" />
562 <!--credits in alternative location #2-->
567 <xsl:if test="$config/credits and ($config/credits/credit/@box-location = 'alt2')">
568 <xsl:for-each select="$config/credits/credit[not(@role='pdf')]">
569 <xsl:if test="@box-location = 'alt2'">
570 <xsl:variable name="name" select="name"/>
571 <xsl:variable name="url" select="url"/>
572 <xsl:variable name="image" select="image"/>
573 <xsl:variable name="width" select="width"/>
574 <xsl:variable name="height" select="height"/><a href="{$url}">
575 <img alt="{$name} - logo" title="{$name}" border="0">
576 <xsl:attribute name="src">
577 <xsl:if test="not(starts-with($image, 'http://'))">
578 <xsl:value-of select="$root"/>
580 <xsl:value-of select="$image"/>
582 <xsl:attribute name="style">
583 <xsl:if test="$width">width: <xsl:value-of select="$width"/>px;</xsl:if>
584 <xsl:if test="$height">height: <xsl:value-of select="$height"/>px;</xsl:if>
596 <xsl:template name="innermenuli">
597 <xsl:param name="id"/>
598 <xsl:variable name="tagid">
600 <xsl:when test="descendant-or-self::node()/li/div/@class='current'">
601 <xsl:value-of select="concat('menu_selected_',$id)"/>
604 <xsl:value-of select="concat('menu_',concat(font,$id))"/>
608 <xsl:variable name="whichGroup">
610 <xsl:when test="descendant-or-self::node()/li/div/@class='current'">selectedmenuitemgroup</xsl:when>
611 <xsl:otherwise>menuitemgroup</xsl:otherwise>
614 <div class="menutitle" id="{$tagid}Title"
615 onclick="SwitchMenu('{$tagid}', '{$root}skin/')">
616 <xsl:if test="contains($tagid, '_selected_')" >
617 <xsl:attribute name="style">
618 <xsl:text>background-image: url('</xsl:text>
619 <xsl:value-of select="$root"/>
620 <xsl:text>skin/images/chapter_open.gif');</xsl:text>
623 <xsl:value-of select="h1"/>
625 <div class="{$whichGroup}" id="{$tagid}">
626 <xsl:if test="contains($tagid, '_selected_')" >
627 <xsl:attribute name="style">
628 <xsl:text>display: block;</xsl:text>
631 <xsl:for-each select= "ul/li">
634 <div class="menuitem"><a>
635 <xsl:attribute name="href">
636 <xsl:value-of select="a/@href"/>
638 <xsl:if test="a/@title!=''">
639 <xsl:attribute name="title">
640 <xsl:value-of select="a/@title"/>
643 <xsl:value-of select="a"/></a>
646 <xsl:when test="div/@class='current'">
647 <div class="menupage">
648 <div class="menupagetitle">
649 <xsl:value-of select="div" />
651 <xsl:if test="$config/toc/@max-depth > 0
652 and contains($minitoc-location,'menu')
653 and count(//tocitems/tocitem) >= $config/toc/@min-sections">
654 <div class="menupageitemgroup">
655 <xsl:for-each select = "//tocitems/tocitem">
656 <div class="menupageitem">
658 <xsl:when test="string-length(@title)>15"><a href="{@href}" title="{@title}">
659 <xsl:value-of select="substring(@title,0,20)" />...</a>
661 <xsl:otherwise><a href="{@href}">
662 <xsl:value-of select="@title" /></a>
672 <xsl:call-template name = "innermenuli">
673 <xsl:with-param name="id" select="concat($id, '.', position())"/>
681 |Generates the PDF link
683 <xsl:template match="div[@id='skinconf-pdflink']">
684 <xsl:if test="not($config/disable-pdf-link) or $disable-pdf-link = 'false'">
685 <div class="pdflink" title="Portable Document Format"><a href="{$filename-noext}.pdf" class="dida">
686 <img class="skin" src="{$skin-img-dir}/pdfdoc.gif" alt="PDF -icon" />
692 <xsl:template match="div[@id='skinconf-xmllink']">
693 <xsl:if test="not($config/disable-xml-link) or $disable-xml-link = 'false'">
694 <div class="xmllink" title="raw XML"><a href="{$filename-noext}.xml" class="dida">
695 <img class="skin" src="{$skin-img-dir}/xmldoc.gif" alt="XML - icon" />
701 <xsl:template match="div[@id='skinconf-txtlink']">
702 <xsl:if test="not($config/disable-txt-link) or $disable-txt-link = 'false'">
703 <div class="podlink" title="Plain Text Documentation"><a href="{$filename-noext}.txt" class="dida">
704 <img class="skin" src="{$skin-img-dir}/txtdoc.png" alt="TXT - icon" />
710 <xsl:template match="div[@id='skinconf-podlink']">
711 <xsl:if test="not($config/disable-pod-link) or $disable-pod-link = 'false'">
712 <div class="podlink" title="Plain Old Documentation"><a href="{$filename-noext}.pod" class="dida">
713 <img class="skin" src="{$skin-img-dir}/poddoc.png" alt="POD - icon" />
719 <xsl:template match="div[@id='skinconf-printlink']">
720 <xsl:if test="not($config/disable-print-link) or $disable-print-link = 'false'">
721 <script type="text/javascript" language="Javascript">
729 <script type="text/javascript" language="Javascript">
730 var NS = (navigator.appName == "Netscape");
731 var VERSION = parseInt(navigator.appVersion);
733 document.write('<div class="printlink" title="Print this Page">');
734 document.write(' <a href="javascript:printit()" class="dida">');
735 document.write(' <img class="skin" src="{$skin-img-dir}/printer.gif" alt="print - icon" />');
736 document.write(' <br />');
737 document.write(' PRINT</a>');
738 document.write('</div>');
743 <xsl:template match="div[@id='disable-font-script']">
744 <xsl:if test="$disable-font-script = 'false'">
746 <i18n:text >Font size:</i18n:text>
747  <input type="button" onclick="ndeSetTextSize('reset'); return false;" title="Reset text" class="resetfont" value="Reset"/>
748  <input type="button" onclick="ndeSetTextSize('decr'); return false;" title="Shrink text" class="smallerfont" value="-a"/>
749  <input type="button" onclick="ndeSetTextSize('incr'); return false;" title="Enlarge text" class="biggerfont" value="+a"/>
753 <xsl:template match="div[@id='skinconf-toc-page']">
754 <!-- Message of the day -->
755 <xsl:if test="$config/motd">
756 <xsl:for-each select="$config/motd/motd-option">
758 <xsl:when test="@starts-with='true'">
759 <xsl:if test="starts-with($path, @pattern)">
760 <xsl:if test="motd-page/@location='page' or motd-page/@location='both'">
762 <xsl:value-of select="motd-page"/>
763 <xsl:if test="motd-page-url">
764 <xsl:text> (</xsl:text><a>
765 <xsl:attribute name="href">
766 <xsl:value-of select="motd-page-url"/>
768 <xsl:text>More</xsl:text></a>
769 <xsl:text>)</xsl:text>
776 <xsl:if test="contains($path, @pattern)">
777 <xsl:if test="motd-page/@location='page' or motd-page/@location='both'">
779 <xsl:value-of select="motd-page"/>
780 <xsl:if test="motd-page-url">
781 <xsl:text> (</xsl:text><a>
782 <xsl:attribute name="href">
783 <xsl:value-of select="motd-page-url"/>
785 <xsl:text>More</xsl:text></a>
786 <xsl:text>)</xsl:text>
795 <!-- Table of Contents ToC -->
796 <xsl:if test="$config/toc">
797 <xsl:if test="contains($minitoc-location,'page')">
798 <xsl:if test="(count(//tocitems/tocitem) >= $config/toc/@min-sections) or (//tocitems/@force = 'true')">
799 <div id="minitoc-area">
800 <xsl:call-template name="minitoc">
801 <xsl:with-param name="tocroot" select="//tocitems"/>