Page To XHTML Transform Using REXSEL.

Constructs the main body of the page in which all the various panels sit.

// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // Page to XHTML Transform: Build Body // // Author: // Name : Hugh Field-Richards // Email : hsfr@hsfr.org.uk // // Copyright 2009 - 2024 Hugh Field-Richards. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* stylesheet { version "1.0" xmlns "page" "http://www.hsfr.org.uk/Schema/Page" xmlns "graphic" "http://www.hsfr.org.uk/Schema/Graphic" xmlns "a" "http://relaxng.org/ns/annotation/1.0" xmlns "xhtml" "http://www.w3.org/1999/xhtml" xmlns "list" "http://www.hsfr.org.uk/Schema/List" xmlns "link" "http://www.hsfr.org.uk/Schema/Link" xmlns "text" "http://www.hsfr.org.uk/Schema/Text" xmlns "news" "http://www.hsfr.org.uk/Schema/News" xmlns "email" "http://www.hsfr.org.uk/Schema/Email" xmlns “paloose” “http://www.paloose.org/schemas/Paloose/1.0" include "buildTopPanel.xsl" include "buildMenusPanel.xsl" // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // The body has a single frame in which all the various panels site. function buildBody.htmlBody { element "div" { attribute "id" "topPanel" call buildTopPanel.topPanel } if "//breadcrumbs//list:item[@id = $gPage]" { element "div" { attribute "id" "breadcrumbPanel" call buildBody.buildBreadcrumbs } } element "div" { attribute "id" "contentPanel" choose { when "$gPage = 'index'" { call buildBody.buildIndex } when "$gPage = 'faq'" { call buildBody.buildFAQ } when "$gPage = 'news'" { call buildBody.buildNews } otherwise { apply-templates using "//content/page:content/*" scope "inline-text" } } } element "div" { attribute "id" "copyrightPanel" value "//page:copyright" apply-templates using "//page:copyright/*" scope "inline-text" } } // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // The Index Page is slightly different to the others. There are two // columns: the left for standard content (id = 'body'), and the right // for news etc. Because of the way that divs do not work vertically in // sensible columns (the containing div never sets its height properly // without tortuous CSS workings) I use a simple two cell table here. // And devil take the purists. function buildBody.buildIndex { element "table" { attribute "id" "indexPageTable" element "tr" { element "td" { attribute "id" "leftPanel" apply-templates using "//content/page:content/text:group[@id = 'body']/*" scope "inline-text" } element "td" { attribute "id" "rightPanel" element "div" { attribute "id" "downloadPanel" element "div" { attribute "class" "downloadPanelText" element "a" { attribute "href" "downloads/paloose-latest.tgz" element "h2" { text "Download Latest Version" } element "p" { value "document('../../content/downloads.xml')//paloose:versions/paloose:version/paloose:version-number" } } } } element "div" { attribute "id" "latestNewsPanel" element "div" { attribute "class" "latestNewsPanelText" element "a" { attribute "href" "news.html" element "h2" { text "Latest News" } element "p" { value "//news:channel/news:description" } } } } element "div" { attribute "id" "rightPanelText" element "h2" { text "Paloose supports..." } apply-templates using "//content/page:content/text:group[@id = 'rightPanel']/*" scope "inline-text" } } } } } // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // The FAQ requires an index at the top. function buildBody.buildFAQ { apply-templates using "//page:content/text:heading[@level = '1']" scope "inline-text" element "div" { attribute "class" "faqContents" foreach "//page:content/text:group[@label = 'faqEntry']/text:heading[@level = '2']" { element "div" { attribute "class" "faqContentsItem" element "a" { attribute "href" { value "concat('#', @id)" } apply-templates scope “inline-text" } } } } foreach “//page:content//text:group[@label = 'faqEntry']" { apply-templates scope "inline-text" element "div" { attribute "class" "returnToTop" element "a" { attribute "href" "#topOfPage" value "//list:list[@id = 'headings']/list:item[@id = 'returnTop']" } } } } // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // The News page requires an index at the top. function buildBody.buildNews { apply-templates using "//content/page:content/*" scope "inline-text" foreach "//news-articles/news:channel" { element "div" { attribute "class" "mainNEWSdate" element "a" { attribute "name" { value "@id" } value "news:date" } text " — " value "news:title" element "div" { attribute "class" "newsArticleBody" apply-templates using "news:text" scope "inline-text" } } } } // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // The News page requires an index at the top. function buildBody.buildBreadcrumbs { element "ul" { attribute "id" "crumbs" foreach "//breadcrumbs//list:item[@id = $gPage]/ancestor-or-self::*" { if "@id" { element "li" { element "a" { attribute "href" { value "link:link/@ref" } value "link:link" if "not(position() = last())" { text " > " } } } } } } } }
Copyright 2006 – 2024 Hugh Field-Richards. All Rights Reserved.