<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
<!--

	Page to XHTML Transform

	 Author:
		Name  : Hugh Field-Richards
		Email : hsfr@hsfr.org.uk

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Copyright -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
   
  LICENSE:
  
  Paloose is free software: you can redistribute it and/or modify 
  it under the terms of the GNU General Public License as published by 
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version. 
  
  This program is distributed in the hope that it will be useful, 
  but WITHOUT ANY WARRANTY; without even the implied warranty of 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  GNU General Public License for more details. 
  
  You should have received a copy of the GNU General Public License 
  along with this program.  If not, see <http://www.gnu.org/licenses/> 
 
  Copyright 2006 - 2010 Hugh Field-Richards.
   
-->
<xsl:stylesheet version="1.0" __file="ba7394b12651132cd7f6025be83040c6" __status="-1">......</xsl:stylesheet>
<xsl:stylesheet version="1.0" __file="ba7394b12651132cd7f6025be83040c6" __status="-1" xmlns:email="http://www.hsfr.org.uk/Schema/Email" xmlns:page="http://www.hsfr.org.uk/Schema/Page" xmlns:news="http://www.hsfr.org.uk/Schema/News" xmlns:text="http://www.hsfr.org.uk/Schema/Text" xmlns:link="http://www.hsfr.org.uk/Schema/Link" xmlns:list="http://www.hsfr.org.uk/Schema/List" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:a="http://relaxng.org/ns/annotation/1.0" xmlns:graphic="http://www.hsfr.org.uk/Schema/Graphic" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
 a:documentation>
      <dc:title>Page to XHTML Transform</dc:title>
      <dc:creator>Hugh Field-Richards</dc:creator>
      <dc:date>2012-06-16T12:10</dc:date>
      <dc:language>en</dc:language>
   </a:documentation>

   <xhtml:h1>Licence</xhtml:h1>

   <xhtml:p>This software is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
      License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later
      version.</xhtml:p>

   <xhtml:p>This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</xhtml:p>

   <xhtml:p>You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free
      Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</xhtml:p 
-->
<xhtml:h1>Description</xhtml:h1>
<xhtml:p>This is the RELAX NG schema for the XML scraps used in the Paloose CMS. It is not used except to check the scraps when developing a new site. It saves a lot of pain when debugging.</xhtml:p>
<xsl:output encoding="UTF-8"/>
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
<!--
      Add any parameters from the sitemap here. For example
      
      <map:transform src="context://resources/transforms/page2html.xsl">
      <map:parameter name="page" value="{1}"/>
      </map:transform>
   
-->
<xhtml:h2>Global Parameters</xhtml:h2>
<xhtml:p>The page id derived from the sitemap and is usually the file name without the extension.</xhtml:p>
<xsl:param name="page"/>
<xhtml:p>Set to true in admin pipeline, otherwise left as false.</xhtml:p>
<xsl:param name="admin" select="0"/>
<xhtml:p>The short name used in the admin sessions.</xhtml:p>
<xsl:param name="sessionUser"/>
<xhtml:p>The long name used in the admin sessions.</xhtml:p>
<xsl:param name="sessionFullname"/>
<xhtml:p>Locale information from the sitemap (query string parameter).</xhtml:p>
<xsl:param name="locale"/>
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
<!--
      Add your global variables here as required. The default values are set here as well.
   
-->
<xhtml:h2>Global Variables</xhtml:h2>
<xhtml:p>Global variable for the page name.</xhtml:p>
<xsl:variable name="gPage" select="$page"/>
<xhtml:p>Global variable for the admin parameter.</xhtml:p>
<xsl:variable name="gAdmin" select="$admin"/>
<xhtml:p>Global variable for the short name session user parameter.</xhtml:p>
<xsl:variable name="gSessionUser" select="$sessionUser"/>
<xhtml:p>Global variable for the full name session user parameter.</xhtml:p>
<xsl:variable name="gFullName" select="$sessionFullname"/>
<xhtml:p>Global variable for the page title. If it is not present in the source file then a default is used.</xhtml:p>
<xsl:variable name="gPageTitle">......</xsl:variable>
<xsl:variable name="gPageTitle">
<xsl:choose>......</xsl:choose>
<xsl:choose>
<xsl:when test="string-length( //page:meta/page:pageTitle ) > 0">......</xsl:when>
<xsl:when test="string-length( //page:meta/page:pageTitle ) > 0">
<xsl:value-of select="//page:meta/page:pageTitle"/>
</xsl:when>
<xsl:otherwise>......</xsl:otherwise>
<xsl:otherwise>
<xsl:value-of select="'Paloose'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
<!--
   
-->
<xhtml:h2>Global Variables</xhtml:h2>
<xhtml:p>Comma separated list of style files. But the styles files use a semicolon (don't ask!). </xhtml:p>
<xhtml:p>Path to CSS files directory.</xhtml:p>
<xsl:variable name="gCSSFilesDir" select="'/pp/resources/styles/'"/>
<xhtml:p>Comma separated list of CSS files.</xhtml:p>
<xsl:variable name="gCSSFiles" select="'paloose.css,topPanel.css,menusPanel.css,text.css,faq.css,jqueryslidemenu.css,breadcrumb.css,ppForms.css'"/>
<xhtml:p>Path to script files directory.</xhtml:p>
<xsl:variable name="gScriptFilesDir" select="'/pp/resources/scripts/'"/>
<xhtml:p>Semicolon separated list of script files.</xhtml:p>
<xsl:variable name="gScriptFiles" select="'jquery.js;jqueryslidemenu.js'"/>
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
<!--
      
   
-->
<xhtml:h2>Root Template</xhtml:h2>
<xhtml:p>Where it all starts. It should not be necessary to change anything in here. The main user change area is all within the buildBody etc.</xhtml:p>
<xsl:template match="/">......</xsl:template>
<xsl:template match="/">
<xsl:element name="html">......</xsl:element>
<xsl:element name="html">
<xsl:attribute name="lang">en</xsl:attribute>
<!--
 Put html attributes here - for example language 
-->
<xsl:element name="head">......</xsl:element>
<xsl:element name="head">
<xsl:call-template name="buildHeader.htmlHead">......</xsl:call-template>
<xsl:call-template name="buildHeader.htmlHead">
<xsl:with-param name="inTitle" select="$gPageTitle"/>
<xsl:with-param name="inStylesList" select="$gCSSFiles"/>
<xsl:with-param name="inStylesDir" select="$gCSSFilesDir"/>
<xsl:with-param name="inScriptsList" select="$gScriptFiles"/>
<xsl:with-param name="inScriptsDir" select="$gScriptFilesDir"/>
</xsl:call-template>
</xsl:element>
<xsl:element name="body">......</xsl:element>
<xsl:element name="body">
<xsl:element name="a">......</xsl:element>
<xsl:element name="a">
<xsl:attribute name="name">topOfPage</xsl:attribute>
</xsl:element>
<xsl:element name="div">......</xsl:element>
<xsl:element name="div">
<xsl:attribute name="id">bodyFrame</xsl:attribute>
<xsl:call-template name="buildBody.htmlBody"/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
<xhtml:h2>Includes</xhtml:h2>
<xhtml:p>Any external XSL files to be included go here. These go at the end to make sure the above override them.</xhtml:p>
<xsl:include href="buildHeader.xsl"/>
<xsl:include href="buildBody.xsl"/>
<xsl:include href="text2html.xsl"/>
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
-->
<xhtml:h2>Utility functions</xhtml:h2>
<xhtml:p>......</xhtml:p>
<xhtml:p>
<i>common.substring-after-last</i>
is required because XSL does not have the function.
</xhtml:p>
<xsl:template name="common.substring-after-last">......</xsl:template>
<xsl:template name="common.substring-after-last">
<xsl:param name="string"/>
<xsl:param name="delimiter"/>
<xsl:choose>......</xsl:choose>
<xsl:choose>
<xsl:when test="contains($string, $delimiter)">......</xsl:when>
<xsl:when test="contains($string, $delimiter)">
<xsl:call-template name="common.substring-after-last">......</xsl:call-template>
<xsl:call-template name="common.substring-after-last">
<xsl:with-param name="string" select="substring-after($string, $delimiter)"/>
<xsl:with-param name="delimiter" select="$delimiter"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>......</xsl:otherwise>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
-->
<xhtml:p>Soak up any remaining elements not processed by the above.</xhtml:p>
<xsl:template match="node()|@*" priority="-1">......</xsl:template>
<xsl:template match="node()|@*" priority="-1">
<xsl:copy>......</xsl:copy>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>