Page To XHTML Transform Using REXSEL.
The Paloose site uses the Rexsel language to create the HTML pages from XML. Rexsel
is a compact version of XSL that is compiled into the latter during the build stage of producing the Web site. The XML is a specifically
designed format for Paloose sites which is translated to XHTML.
It uses several included files:
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Page to XHTML Transform
//
// 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.
///
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// This is the main XML to XHTML for the Paloose WEB site. It is written
// in Rexsel, a simplified and compact version of the XSLT language
// that is written in XML. The Rexsel code is translated at build time
// from within a Ant script.
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 "dc" "http://purl.org/dc/elements/1.1/"
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"
output {
encoding "UTF-8“
}
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* PARAMETERS -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// The page id derived from the sitemap and is usually the file name without the extension.
parameter page
// Set to true in admin pipeline, otherwise left as false.
parameter admin "0"
// The short name used in the admin sessions.
parameter sessionUser
// The long name used in the admin sessions.
parameter sessionFullname
// Locale information from the sitemap (query string parameter).
parameter locale
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- VARIABLES -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// Global variable for the page name.
variable gPage "$page”
// Global variable for the admin parameter.
variable gAdmin "$admin"
// Global variable for the short name session user parameter.
variable gSessionUser "$sessionUser"
// Global variable for the full name session user parameter.
variable gFullName "$sessionFullname"
// Global variable for the page title. If it is not present in
// the source file then a default is used.
variable gPageTitle {
choose {
when "string-length(//page:meta/page:pageTitle) > 0" {
value "//page:meta/page:pageTitle"
}
otherwise {
value "'Paloose'"
}
}
}
// Path to CSS files directory. Remember there is a
// SCSS folder as well that has the CSS declarations.
constant gCSSFilesDir "'/pp/resources/styles/'"
// Comma separated list of CSS files.
constant gCSSFiles "'paloose.css'"
// Path to script files directory.
constant gScriptFilesDir "'/pp/resources/scripts/'"
// Semicolon separated list of script files.
constant gScriptFiles "'jquery.js'"
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- TEMPLATES -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Where it all starts. It should not be necessary to change anything in here.
// The main user change area is all within the buildBody.xsl transforms.
match using "/" {
element "html" namespace "http://www.w3.org/1999/html" {
attribute "lang" "en"
element "head” namespace "http://www.w3.org/1999/html" {
call buildHeader.htmlHead {
with inTitle "$gPageTitle"
with inStylesList "$gCSSFiles"
with inStylesDir "$gCSSFilesDir"
with inScriptsList "$gScriptFiles"
with inScriptsDir "$gScriptFilesDir"
}
}
element "body" {
attribute "name" "topOfPage"
element “a” {
attribute “name” "topOfPage”
}
element "div" {
attribute “id” "bodyFrame”
call buildBody.htmlBody
}
}
}
}
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* INCLUDES -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Any external XSL files to be included go here. These go here to make
// sure the above override them.
include "buildHeader.xsl"
include "buildBody.xsl"
include "text2html.xsl"
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* UTILITY FUNCTIONS *-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// common.substring-after-last
//
// This is required because XSL does not have this function.
function common.substring-after-last {
parameter string
parameter delimiter
choose {
when "contains($string, $delimiter)" {
call common.substring-after-last {
with string “substring-after($string, $delimiter)”
with delimiter “$delimiter”
}
}
otherwise {
value “$string”
}
}
}
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Soak up any remaining elements not processed by the above.
match using "node() | @*" priority "-1" {
copy {
apply-templates using "@*"
apply-templates
}
}
}
Copyright 2006 – 2024 Hugh Field-Richards. All Rights Reserved.