diff options
Diffstat (limited to 'page.xsl')
-rw-r--r-- | page.xsl | 651 |
1 files changed, 651 insertions, 0 deletions
diff --git a/page.xsl b/page.xsl new file mode 100644 index 0000000..9a60496 --- /dev/null +++ b/page.xsl @@ -0,0 +1,651 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:output method="xml" + version="1.0" + encoding="UTF-8" + indent="yes" + omit-xml-declaration="yes" + doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" /> +<xsl:param name="page" /> + +<xsl:template match="/"> + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> +<head> + +<!-- Establish character encoding --> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> + +<!-- Force reload from server, not local cache --> +<meta http-equiv="pragma" content="no-cache" /> + +<!-- Allows search engine bots to index this page --> +<meta name="ROBOTS" content="ALL" /> + +<!-- Disables Microsoft's Smart Tags functionality on this page --> +<meta name="MSSmartTagsPreventParsing" content="true" /> + +<!-- Provides keywords for search engines --> +<meta name="KEYWORDS"><xsl:attribute name="content"><xsl:value-of select="xml/global/keywords"/></xsl:attribute></meta> + +<title><xsl:value-of select="xml/global/title" /></title> + +<!-- Default stylesheet --> +<style media="all" type="text/css">@import "css/styles_white.css";</style> + +<xsl:comment><![CDATA[[if IE]><link rel="stylesheet" href="css/ie.css" type="text/css" /><![endif] ]]></xsl:comment> +<xsl:comment><![CDATA[[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen" href="css/ie6.css" /><![endif]]]></xsl:comment> + + +<script type="text/javascript" language="JavaScript"> +<xsl:comment><![CDATA[ + logos = new Array(); + logos[0] = 'assets/logo_white_01.png'; + logos[1] = 'assets/logo_white_02.png'; + logos[2] = 'assets/logo_white_03.png'; + logos[3] = 'assets/logo_white_04.png'; + logos[4] = 'assets/logo_white_05.png'; + logos[5] = 'assets/logo_white_06.png'; + logos[6] = 'assets/logo_white_07.png'; + logos[7] = 'assets/logo_white_08.png'; + logos[8] = 'assets/logo_white_09.png'; + logos[9] = 'assets/logo_white_10.png'; + logos[10] = 'assets/logo_white_11.png'; + logos[11] = 'assets/logo_white_12.png'; + + var loadCSS = function(file) { + var link = document.createElement('link'); + link.href = file; + link.rel = 'stylesheet'; + link.type = 'text/css'; + document.getElementsByTagName('head')[0].appendChild(link); + }; + + function newImage() + { + r = Math.round(Math.random()*11); + document.getElementById("logo").setAttribute("src", logos[r]) + + // get corresponding stylesheet + if (r == 0) { loadCSS('css/styles_white_01.css'); } + if (r == 1) { loadCSS('css/styles_white_02.css'); } + if (r == 2) { loadCSS('css/styles_white_03.css'); } + if (r == 3) { loadCSS('css/styles_white_04.css'); } + if (r == 4) { loadCSS('css/styles_white_05.css'); } + if (r == 5) { loadCSS('css/styles_white_06.css'); } + if (r == 6) { loadCSS('css/styles_white_07.css'); } + if (r == 7) { loadCSS('css/styles_white_08.css'); } + if (r == 8) { loadCSS('css/styles_white_09.css'); } + if (r == 9) { loadCSS('css/styles_white_10.css'); } + if (r == 10) { loadCSS('css/styles_white_11.css'); } + if (r == 11) { loadCSS('css/styles_white_12.css'); } + + } +]]></xsl:comment> +</script> + +<script src="scripts/menu.js" type="text/javascript"></script> +<script src="scripts/prototype.js" type="text/javascript"><xsl:comment/></script> +<script src="scripts/scriptaculous.js" type="text/javascript"><xsl:comment/></script> + +</head> + +<body> + +<!-- logo --> +<div class="logo"><a href="index.php"><img src="assets/spacer.gif" alt="sugarlabs" width="202" height="45" border="0" id="logo" /></a></div> + +<!-- menu --> + +<!-- set variable to get section --> +<xsl:variable name="section"> + <xsl:choose> + <xsl:when test="//page[@id = $page]/@section"> + <xsl:value-of select="//page[@id = $page]/@section" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$page" /> + </xsl:otherwise> + </xsl:choose> +</xsl:variable> + +<ul id="menu"> + <li> + <xsl:choose> + <xsl:when test="//page[@id = $page]/@section"> + <a href="#" name="hint" class="current"> + <xsl:value-of select="//section[@id = $section]/@title" /> + </a> + </xsl:when> + <xsl:otherwise> + <a href="#" name="hint" class="current">menu</a> + </xsl:otherwise> + </xsl:choose> + <ul id="expanded_menu_1"> + <li><a href="index.php" name="index">index</a></li> + + <xsl:for-each select="//xml/sections/section"> + + <li> + <a> + <xsl:attribute name="href"> + <xsl:text>index.php?template=page&page=</xsl:text> + <xsl:value-of select="./@id"/> + </xsl:attribute> + + <xsl:choose> + <xsl:when test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="section"> + <xsl:if test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="section/section"> + <xsl:if test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="section/section/section"> + <xsl:if test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:if> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + + <xsl:value-of select="./@title"/> + </a> + + <xsl:if test="section"> + <ul id="expanded_menu_2"> + <xsl:for-each select="section"> + <li> + <a> + <xsl:attribute name="href"> + <xsl:text>index.php?template=page&page=</xsl:text> + <xsl:value-of select="./@id"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="section"> + <xsl:if test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="section/section"> + <xsl:if test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:if> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + <xsl:value-of select="./@title"/> + </a> + + <xsl:if test="section"> + <ul id="expanded_menu_3"> + <xsl:for-each select="section"> + <li> + <a> + <xsl:attribute name="href"> + <xsl:text>index.php?template=page&page=</xsl:text> + <xsl:value-of select="./@id"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="section"> + <xsl:if test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:if> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + <xsl:value-of select="./@title"/> + </a> + + <xsl:if test="section"> + <ul id="expanded_menu_4"> + <xsl:for-each select="section"> + <li> + <a> + <xsl:attribute name="href"> + <xsl:text>index.php?template=page&page=</xsl:text> + <xsl:value-of select="./@id"/> + </xsl:attribute> + <xsl:if test="./@id = $section"> + <xsl:attribute name="class">selected</xsl:attribute> + </xsl:if> + <xsl:value-of select="./@title"/> + </a> + </li> + </xsl:for-each> + </ul> + </xsl:if> + </li> + </xsl:for-each> + </ul> + </xsl:if> + </li> + </xsl:for-each> + </ul> + </xsl:if> + </li> + </xsl:for-each> + </ul> + </li> +</ul> + +<!-- global links --> +<div class="links-container"> + <span class="links"> + <xsl:for-each select="xml/links/link"> + <a class="link"> + <xsl:attribute name="href"> + <xsl:value-of select="./@url"/> + </xsl:attribute> + <xsl:value-of select="."/> + </a> + <xsl:if test="position() < count(//xml/links/link)"> + <xsl:text> / </xsl:text> + </xsl:if> + </xsl:for-each> + </span> +</div> + +<!-- fullscale imagery --> +<xsl:if test="//xml/page[@id = $page]/media"> + <div class="media"> + <xsl:for-each select="//xml/page[@id = $page]/media/*"> + <ul> + <li><xsl:apply-templates select="." /></li> + <xsl:if test="title"> + <li><span class="title"><xsl:apply-templates select="title"/></span></li> + </xsl:if> + <xsl:if test="caption"> + <li><xsl:apply-templates select="caption"/></li> + </xsl:if> + </ul> + </xsl:for-each> + </div> +</xsl:if> + +<!-- main content well --> +<xsl:if test="(//xml/page[@id = $page]/content) or (//xml/page[@id = $page]/sidebar)"> + <div class="content-container"> + + <xsl:for-each select="//xml/page[@id = $page]/content"> + <div class="content"> + <xsl:for-each select="paragraph"> + <div class="text"> + <xsl:if test="headline"> + <div class="headline"><xsl:value-of select="headline"/></div> + </xsl:if> + <xsl:if test="image"> + <xsl:apply-templates select="image"/> + </xsl:if> + <xsl:if test="caption"> + <span class="links"><xsl:apply-templates select="caption"/></span> + </xsl:if> + <xsl:if test="lead"> + <xsl:apply-templates select="lead"/> + </xsl:if> + <xsl:if test="text"> + <xsl:apply-templates select="text"/> + </xsl:if> + <xsl:if test="list"> + <ul class="bullet main"> + <xsl:for-each select="list/item"> + <li><xsl:apply-templates select="."/></li> + </xsl:for-each> + </ul> + </xsl:if> + </div> + </xsl:for-each> + </div> + + <!-- sidebar --> + <xsl:if test="sidebar"> + <div class="sidebar"> + <xsl:for-each select="sidebar/*"> + <xsl:if test="local-name()='thumbnail'"> + <div class="thumb-wrapper spc last"> + <div class="spc"> + <xsl:choose> + <xsl:when test="@id or @url"> + <a> + <xsl:attribute name="href"> + <xsl:if test="@id"> + <xsl:text>index.php?template=page&page=</xsl:text> + <xsl:value-of select="@id"/> + </xsl:if> + <xsl:if test="@url"> + <xsl:value-of select="@url"/> + </xsl:if> + </xsl:attribute> + + <xsl:apply-templates select="image" /> + </a> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="image" /> + </xsl:otherwise> + </xsl:choose> + </div> + <xsl:if test="title"> + <div> + <xsl:choose> + <xsl:when test="@id or @url"> + <a class="link"> + <xsl:attribute name="href"> + <xsl:if test="@id"> + <xsl:text>index.php?template=page&page=</xsl:text> + <xsl:value-of select="@id"/> + </xsl:if> + <xsl:if test="@url"> + <xsl:value-of select="@url"/> + </xsl:if> + </xsl:attribute> + + <xsl:value-of select="title"/> + </a> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="title"/> + </xsl:otherwise> + </xsl:choose> + </div> + </xsl:if> + <xsl:if test="caption"> + <div><xsl:value-of select="caption"/></div> + </xsl:if> + </div> + </xsl:if> + <xsl:if test="local-name()='paragraph'"> + <div class="links clr"> + <xsl:if test="./@topmargin"> + <xsl:attribute name="style"> + <xsl:text>margin-top: </xsl:text> + <xsl:apply-templates select="./@topmargin"/> + <xsl:text>px</xsl:text> + </xsl:attribute> + </xsl:if> + + <xsl:apply-templates select="."/> + </div> + </xsl:if> + </xsl:for-each> + </div> + </xsl:if> + </xsl:for-each> + + </div> +</xsl:if> + +<!-- thumbnails --> +<xsl:if test="//xml/page[@id = $page]/thumbnails"> + <div class="thumbnails"> + <xsl:for-each select="//xml/page[@id = $page]/thumbnails/thumbnail[position() mod 4 = 1]"> + <ul> + <xsl:apply-templates select=".|following-sibling::*[position() < 4]" /> + </ul> + </xsl:for-each> + </div> +</xsl:if> + +<!-- global pagination --> + +<!-- set variable to node position --> +<xsl:variable name="nodepos"> + <xsl:for-each select="//page[@paginate]"> + + <xsl:if test="@id = $page"> + <xsl:value-of select="position()"/> + </xsl:if> + + </xsl:for-each> +</xsl:variable> + +<xsl:if test="//page[@id = $page]/@paginate"> +<div class="pagination"> + + <!-- pagination --> + <xsl:if test="$nodepos - 1 > 0"> + <a class="link"> + <xsl:attribute name="href"> + <xsl:choose> + <xsl:when test="//page[$nodepos - 1]/@id = 'index'"> + <xsl:text>index.php</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>index.php?template=page&page=</xsl:text> + <xsl:for-each select="//page[@paginate]"> + <xsl:if test="position() = $nodepos - 1"> + <xsl:value-of select="./@id"/> + </xsl:if> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + + </xsl:attribute> + <xsl:text>< previous</xsl:text> + </a> + </xsl:if> + + <xsl:if test="($nodepos - 1 > 0) and ($nodepos + 1 <= count(//page[@paginate]))"> + <xsl:text> / </xsl:text> + </xsl:if> + + <xsl:if test="$nodepos + 1 <= count(//page[@paginate])"> + <a class="link"> + <xsl:attribute name="href"> + <xsl:text>index.php?template=page&page=</xsl:text> + + <xsl:for-each select="//page[@paginate]"> + <xsl:if test="position() = $nodepos + 1"> + <xsl:value-of select="./@id"/> + </xsl:if> + </xsl:for-each> + + </xsl:attribute> + <xsl:text>next ></xsl:text> + </a> + </xsl:if> + +</div> +</xsl:if> + +<!-- footer --> +<div class="footer"><xsl:apply-templates select="xml/global/footer" /></div> + +<script type="text/javascript"> +<xsl:comment><![CDATA[ + +newImage(); +if (location.hash != '') { + id = location.hash.substr(1); + Effect.ScrollTo(id); + Effect.Pulsate(id, { pulses: 4, duration: 2.5 }); +} + +]]></xsl:comment> +</script> + +</body> +</html> +</xsl:template> + +<!-- formatting --> + +<xsl:template match="thumbnail"> + <li class="thumb-wrapper"> + <xsl:if test="image"> + <xsl:choose> + <xsl:when test="@id or @url"> + <div class="spc"> + <a> + <xsl:attribute name="href"> + <xsl:if test="@id"> + <xsl:text>index.php?template=page&page=</xsl:text> + <xsl:value-of select="@id"/> + </xsl:if> + <xsl:if test="@url"> + <xsl:value-of select="@url"/> + </xsl:if> + </xsl:attribute> + + <xsl:apply-templates select="image" /> + </a> + </div> + </xsl:when> + <xsl:otherwise> + <div class="spc"><xsl:apply-templates select="image" /></div> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="title"> + <xsl:choose> + <xsl:when test="@id or @url"> + <div> + <a class="link"> + <xsl:attribute name="href"> + <xsl:if test="@id"> + <xsl:text>index.php?template=page&page=</xsl:text> + <xsl:value-of select="@id"/> + </xsl:if> + <xsl:if test="@url"> + <xsl:value-of select="@url"/> + </xsl:if> + </xsl:attribute> + + <xsl:value-of select="title"/> + </a> + </div> + </xsl:when> + <xsl:otherwise> + <div><xsl:value-of select="title"/></div> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:for-each select="caption"> + <div><xsl:apply-templates select="."/></div> + </xsl:for-each> + </li> +</xsl:template> + +<xsl:template match="list"> + <xsl:choose> + <xsl:when test="@bullet"> + <ul> + <xsl:for-each select="item"> + <li><xsl:apply-templates select="."/></li> + </xsl:for-each> + </ul> + </xsl:when> + <xsl:otherwise> + <ul class="bullet"> + <xsl:for-each select="item"> + <li><xsl:apply-templates select="."/></li> + </xsl:for-each> + </ul> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="keyphrase"> + + <!-- set variable to get keyphrase --> + <xsl:variable name="keyphrase"> + <xsl:value-of select="."/> + </xsl:variable> + + <a> + <xsl:attribute name="id"> + <xsl:for-each select="//keyphrase"> + <xsl:if test=". = $keyphrase"> + <xsl:text>phrase</xsl:text> + <xsl:value-of select="position()" /> + </xsl:if> + </xsl:for-each> + </xsl:attribute> + + <xsl:attribute name="name"> + <xsl:for-each select="//keyphrase"> + <xsl:if test=". = $keyphrase"> + <xsl:text>phrase</xsl:text> + <xsl:value-of select="position()" /> + </xsl:if> + </xsl:for-each> + </xsl:attribute> + + <span class="emphasis"> + <xsl:value-of select="."/> + </span> + </a> +</xsl:template> + +<xsl:template match="link"> + <a xmlns="http://www.w3.org/1999/xhtml" class="link"> + <xsl:if test="@external"> + <xsl:attribute name="target">_blank</xsl:attribute> + </xsl:if> + <xsl:attribute name="href"> + <xsl:if test="@url"><xsl:value-of select="@url"/></xsl:if> + <xsl:if test="@id">index.php?template=page&page=<xsl:value-of select="@id"/></xsl:if> + </xsl:attribute> + <xsl:value-of select="."/> + </a> +</xsl:template> + +<xsl:template match="line-break"> + <br xmlns="http://www.w3.org/1999/xhtml" /> +</xsl:template> + +<xsl:template match="italic"> + <em xmlns="http://www.w3.org/1999/xhtml"> + <xsl:value-of select="."/> + </em> +</xsl:template> + +<xsl:template match="image"> + <img border="0"> + <xsl:attribute name="src"><xsl:value-of select="@url"/></xsl:attribute> + <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute> + <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute> + <xsl:if test="@border = 'true'"> + <xsl:attribute name="class">thumb</xsl:attribute> + </xsl:if> + </img> +</xsl:template> + +<xsl:template match="video"> + <embed> + <xsl:attribute name="autoplay">true</xsl:attribute> + <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute> + <xsl:attribute name="height"><xsl:value-of select="@height + 15"/></xsl:attribute> + <xsl:attribute name="src"><xsl:value-of select="@url"/></xsl:attribute> + </embed> +</xsl:template> + +<xsl:template match="headline"> + <span class="headline"> + <xsl:value-of select="."/> + </span> +</xsl:template> + +<xsl:template match="lead"> + <span class="headline"> + <xsl:value-of select="."/> + </span> +</xsl:template> + +</xsl:stylesheet>
\ No newline at end of file |