Build Header Transform
This script provides a set of functions that support outputing the various header information (scripts and styles).
buildHeader.rxsl
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Page to XHTML Transform: Build Body Head
//
// Author:
// Name : Hugh Field-Richards
// Email : hsfr@hsfr.org.uk
//
// Copyright 2025 Hugh Field-Richards.
//
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
stylesheet {
version "1.0"
xmlns "page" "http://www.hsfr.org.uk/Schema/Page"
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"
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Build HTML Head
//
// Parameters
// inTitle the title of the page.
// inStylesList the list of style files to output (file-1,file-2,file-3, ...).
// inStylesDir the folder where the style files are stored.
// inScriptsList the list of script files to output (file-1;file-2;file-3; ...).
// inScriptsDir the folder where the script files are stored.
proc buildHeader.htmlHead {
parameter inTitle
parameter inStylesList
parameter inStylesDir
parameter inScriptsList
parameter inScriptsDir
element "meta" {
attribute "name" "DC.creator"
attribute "content" "Hugh Field-Richards"
}
element "meta" {
attribute "name" "DC.language"
attribute "content" "en"
}
element "meta" {
attribute "name" "DC.subject"
attribute "content" "Rexsel,XML,XSL"
}
element "meta" {
attribute "name" "DC.Date.created"
attribute "content" "2024-01-26T13:00"
}
element "meta" {
attribute "name" "DC.Format"
attribute "content" "text/html"
}
element "meta" {
attribute "name" "DC.Rights"
attribute "lang" "en"
attribute "content" "Copyright 2025 Hugh Field-Richards"
}
element "meta" {
attribute "name" "DC.Title"
attribute "lang" "en"
attribute "content" "Rexsel"
}
element "meta" {
attribute "name" "DC.Description"
attribute "lang" "en"
attribute "content" "A compact XSL language"
}
element "meta" {
attribute "name" "DC.Identifier"
attribute "lang" "en"
attribute "content" "http://www.rexsel.org/"
}
element "link" {
attribute "rel" "icon"
attribute "type" "image/png"
attribute "href" "rexsel-favicon.png"
}
element "title" {
value "$inTitle"
}
call buildHeader.outputScriptsList {
with inScriptsList "$inScriptsList"
with inScriptsDir "$inScriptsDir"
}
call buildHeader.outputStylesList {
with inStylesList "$inStylesList"
with inStylesDir "$inStylesDir"
}
}
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Output Style Files
//
// Output a list of copmma separated style file as a list of links:
//
// <link href="file-1" ... />
// <link href="file-2" ... />
// <link href="file-3" ... />
// etc.
//
// Parameters
// inStylesList the list of style files to output (file-1,file-2,file-3,...),
// inStylesDir the folder where the style files are stored.
proc buildHeader.outputStylesList {
parameter inStylesList
parameter inStylesDir
choose {
when "contains($inStylesList, ',')" {
variable firstStyle “substring-before($inStylesList, ‘,’)”
variable remainderStyles “substring-after($inStylesList, ',')”
call buildHeader.outputStyle {
with inStyle "$firstStyle"
with inStylesDir "$inStylesDir"
}
call buildHeader.outputStylesList {
with inStylesList "$remainderStyles"
with inStylesDir "$inStylesDir"
}
}
otherwise {
call buildHeader.outputStyle {
with inStyle "$inStylesList"
with inStylesDir "$inStylesDir"
}
}
}
}
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Output Single Style File
//
// Output a single style files as
//
// <link href="file-1" rel="stylesheet" type="text/css" />
//
// Parameters
// inStyle the style files to be output.
// inStylesDir the folder where the style file is stored.
proc buildHeader.outputStyle {
parameter inStyle
parameter inStylesDir
element "link" {
attribute "href" {
value “concat($inStylesDir, $inStyle)"
}
attribute "rel" "stylesheet"
attribute "type" "text/css"
}
}
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Output Script Files
//
// Output a list of semicoln separated script file as a list of links:
//
// <script type="text/javascript" src="file-1.js"> </script>
// <script type="text/javascript" src="file-2.js"> </script>
// <script type="text/javascript" src="file-3.js"> </script>
// etc.
//
// Parameters
// inScriptsList the list of script files to output (file-1;file-2;file-;...).
// inScriptsDir the folder where the script files are stored.
proc buildHeader.outputScriptsList {
parameter inScriptsList
parameter inScriptsDir
choose {
when "contains($inScriptsList, ';')" {
variable firstScript “substring-before($inScriptsList, ‘;’)”
variable remainderScripts “substring-after($inScriptsList, ‘;’)”
call buildHeader.outputScript {
with inScript "$firstScript"
with inScriptsDir "$inScriptsDir"
}
call buildHeader.outputScriptsList {
with inScriptsList "$remainderScripts"
with inScriptsDir "$inScriptsDir"
}
}
otherwise {
call buildHeader.outputScript {
with inScript "$inScriptsList"
with inScriptsDir "$inScriptsDir"
}
}
}
}
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
// Output Single Script File
//
// Output a single script files as
//
// <script type="text/javascript" src="js/prototype.js"> </script>
//
// - Parameters:
// - inScript the script files to be output.
// - inScriptsDir the folder where the script file is stored.
proc buildHeader.outputScript {
parameter inScript
parameter inScriptsDir
element "script" {
attribute "src" {
value “concat($inScriptsDir, $inScript)"
}
attribute "type" "text/javascript"
}
}
}
Copyright 2024 Hugh Field-Richards. All Rights Reserved.