Page Transform

This is the main source file for the transform. It is compiled when the system is built. It does not need to be done for each browser request as it should not change.

The page build script includes several other scripts: 'buildHeader.rxsl', 'buildBody.rxsl' and 'text2xhtml.rxsl'.

page2xhtml.rxsl
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // Page to XHTML Transform // // Author: // Name : Hugh Field-Richards // Email : hsfr@hsfr.org.uk // // Copyright 2024 Hugh Field-Richards. // // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // 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" xmlns "table" "http://www.hsfr.org.uk/Schema/Table" xmlns "rexsel" "http://www.hsfr.org.uk/Schema/Rexsel/1.0" 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 "'Rexsel'" } } } // Path to CSS files directory. Remember there is a // SCSS folder as well that has the CSS declarations. constant gCSSFilesDir "'/rexsel/resources/styles/'" // Comma separated list of CSS files. constant gCSSFiles "'rexsel.css'" // Path to script files directory. constant gScriptFilesDir "'/rexsel/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 "text2xhtml.xsl" include "commonFunctions.xsl" // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // Process Remaining Elements // // Soak up any remaining elements not processed by the above. match using "node() | @*" priority "-1" { copy { apply-templates using "@*" apply-templates } } }
Copyright 2024 Hugh Field-Richards. All Rights Reserved.