Header To XHTML Transform Using REXSEL.

Constructs the header data for the HTML file to the browser (lists of scripts and style files).

// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // Page to XHTML Transform: Build Body Head // // 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" // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // // 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. function 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" "Paloose,XML,XSL,Cocoon,PHP,Joomla,WordPress,plugin" } element "meta" { attribute "name" "DC.Date.created" attribute "content" "2010-08-26T13:00" } element "meta" { attribute "name" "DC.Format" attribute "content" "text/html" } element "meta" { attribute "name" "DC.Rights" attribute "lang" "en" attribute "content" "Copyright 2006-2011 Hugh Field-Richards" } element "meta" { attribute "name" "DC.Title" attribute "lang" "en" attribute "content" "Paloose" } element "meta" { attribute "name" "DC.Description" attribute "lang" "en" attribute "content" "A Cocoon like system for XML/XSL based on PHP5" } element "meta" { attribute "name" "DC.Identifier" attribute "lang" "en" attribute "content" "http://www.paloose.org/" } element "link" { attribute "rel" "icon" attribute "type" "image/png" attribute "href" "paloose-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. function 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. function 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. function 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. function buildHeader.outputScript { parameter inScript parameter inScriptsDir element "script" { attribute "src" { value “concat($inScriptsDir, $inScript)" } attribute "type" "text/javascript" } } }
Copyright 2006 – 2024 Hugh Field-Richards. All Rights Reserved.