<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<!--
COMMMON STYLESHEET for UAEX 2013 Implementation
Imported by all pagetype specific stylesheets, and imports utility stylesheets.
Defines html, xsl templates and functions used globally throughout the implementation
Defines outer html structure and common include content.

Contributors: Vinit Varghese, Caroline Spooner
Last Updated 6/2013
-->
<xsl:stylesheet version="3.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:ou="http://omniupdate.com/XSL/Variables"
    xmlns:fn="http://omniupdate.com/XSL/Functions"
    xmlns:ouc="http://omniupdate.com/XSL/Variables"
    exclude-result-prefixes="ou xsl xs fn ouc">
    
    <xsl:import href="template-matches.xsl"/>
    <xsl:import href="vars.xsl"/>
    <xsl:import href="functions.xsl"/>
    <xsl:import href="table-transformations.xsl"/>
    <xsl:import href="breadcrumb.xsl"/>
    <xsl:import href="nested-nav.xsl"/>
    <xsl:import href="__extras/ouforms.xsl"/> 
    <xsl:import href="__extras/ougalleries.xsl"/> 
    
    <xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
    
    <xsl:template match="/*:document"> <!-- match a document with any namespace -->	
        
        <!-- begin html -->
        <!-- <xsl:call-template name="server-model" /> -->
        <xsl:text disable-output-escaping="yes">&lt;</xsl:text>!DOCTYPE html<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
        <xsl:text disable-output-escaping="yes">&lt;</xsl:text>html<xsl:text disable-output-escaping="yes"> lang="en" &gt;</xsl:text>
        
        <head>
            
            <xsl:call-template name="common-headcode"/> <!-- common headcode -->
            
            <xsl:apply-templates select="headcode/node()" mode="copy"/> 
            
            <title><xsl:value-of select="$pageTitle"/></title>
            
            <!-- copy meta tags from pcf, but only those with content -->
            <meta charset="utf-8"/>
            <xsl:for-each select="/*:document/metadata//meta">
                <xsl:if test="string-length(@content)>0">
                    <xsl:apply-templates select="." mode="copy"/>
                </xsl:if>
            </xsl:for-each>
            
            
        </head>
        <body>				
            <xsl:apply-templates select="bodycode/node()" mode="copy"/> <!-- pcf -->
            <!-- start -->
            <noscript>Javascript must be enabled for the correct page display</noscript>
            <div id="wrapper">
                <!-- skip -->
                <xsl:call-template name="common-header"/>
                <!-- main -->
                <xsl:call-template name="page-content"/>
                <!-- footer -->
                <xsl:call-template name="common-footer"/>
                
                <!-- skip -->
                <div class="skip">
                    <a href="#header">Back to top</a>
                </div>
            </div>
        </body>	
        
        <xsl:text disable-output-escaping="yes">&lt;</xsl:text>/html<xsl:text disable-output-escaping="yes">&gt;</xsl:text>	
        <!-- end html -->
        
    </xsl:template>		
    
    <!-- redefine in pagetype xsl as needed -->
    
    <xsl:template name="common-header">
        
        
        
        <div class="skip">
            <a href="#main" accesskey="S">Skip to content, Accesskey F: Farm &amp; Ranch, Accesskey Y: Yard &amp; Garden, Accesskey B: Business &amp; Communities, Accesskey E: Environment &amp; Nature,Accesskey H: Health &amp; Living, Accesskey 4: 4H &amp; Youth</a>
        </div>
        <!-- header -->
        <header id="header">
            <!-- header-holder -->
            <div class="header-holder">
                <div class="container">
                    <!-- header division links: begin -->
                    <nav class="header-nav g3">
                        <ul>
                            <xsl:copy-of select="ou:standardInclude('/_resources/includes/division-nav.inc')"/>
                        </ul>
                    </nav>
                    <!-- header division links: end -->
                </div>
            </div>
            <!-- header-frame -->
            <div class="header-frame">
                <div class="container">
                    <!-- header-block -->
                    <div class="header-block">
                        <!-- auxiliary navigation: begin -->
                        <nav class="add-nav">
                            <ul>
                                <xsl:copy-of select="ou:standardInclude('/_resources/includes/auxiliary-nav.inc')"/>
                            </ul>
                        </nav>
                        <!-- auxiliary navigation: end --> 
                        
                        <!-- form-block -->
                        <div class="form-block">
                            <!-- search box -->
                            <xsl:copy-of select="ou:standardInclude('/_resources/includes/search-box.inc')"/>
                        </div>
                    </div>
                    <!-- logo -->
                    <h1 class="logo"><xsl:copy-of select="ou:standardInclude('/_resources/includes/logo.inc')"/></h1>
                    <!-- button-block -->
                    <div class="button-block">
                        <!-- Share Button:  BEGIN -->
                        <xsl:copy-of select="ou:standardInclude('/_resources/includes/share-button.inc')"/>
                        <!-- Share Button:  END -->
                    </div>
                </div>
            </div>
            <!-- nav-block -->
            <xsl:call-template name="common-top-navigation"/>
        </header>
        
    </xsl:template>
    
    
    <xsl:template name="common-headcode">
        <xsl:copy-of select="ou:standardInclude('/_resources/includes/headcode.inc')"/>
        <!-- search for any instances of LDP forms or galleries -->
       
				<xsl:comment>CSS and JS for OU Galleries</xsl:comment>
				<xsl:copy-of select="ou:gallery-headcode($galleryType)" />
			 
        <!-- <xsl:if test="/*:document/content//ouform">
				<xsl:comment>CSS and JS for OU Forms</xsl:comment>
				<link type="text/css" href="/_resources/css/ouforms-bootstrap.css" rel="stylesheet"/>
				<link type="text/css" href="/_resources/css/error-success.css" rel="stylesheet"/>
			</xsl:if> -->
        <xsl:if test="$ou:action!='pub'">
            <link type="text/css" href="/_resources/css/oustaging.css" rel="stylesheet"/>
        </xsl:if>
        <!-- DirectEdit -->
        <xsl:if test="$ou:action='pub'">
            <script type="text/javascript" src="/_resources/js/directedit.js"></script>
            <script type="text/javascript">
                <xsl:comment><![CDATA[
				window.onload = function(){ directedit(); }
				]]>//</xsl:comment>
            </script>
            
        </xsl:if>
        
    </xsl:template>
    
    <xsl:template name="common-footer"> 
        <footer id="footer">
            <div class="container">
                <!-- footer-columns -->
                <div class="footer-columns cf"> <!-- Left Column Quick Links -->
                    <!-- navigation -->
                    <nav class="g1">
                        <ul>
                            <xsl:copy-of select="ou:standardInclude('/_resources/includes/footer-left.inc')"/>
                        </ul>
                    </nav>
                    <!-- address -->
                    <address class="g1">
						<xsl:copy-of select="ou:standardInclude('/_resources/includes/address.inc')"/>
						<xsl:copy-of select="ou:standardInclude('/_resources/includes/employee-only.inc')"/>
					</address>
                    <!-- navigation -->
                    <!-- Right Column Quick Links --> <nav class="g1 col-last">
                        <ul>
                            <xsl:copy-of select="ou:standardInclude('/_resources/includes/footer-right.inc')"/>
                        </ul>
                    </nav>
                </div>
                <!-- Copyright and Legal Disclaimer Links --> 
                <nav class="footer-nav g3">
                    <ul>
                        <xsl:copy-of select="ou:standardInclude('/_resources/includes/copyright-nav.inc')"/>
                    </ul>
                </nav>
            </div>
            <xsl:apply-templates select="footcode/node()" mode="copy"/> <!-- pcf -->	
        </footer>
        <div id="hidden" style="display:none;"><xsl:comment> com.omniupdate.ob </xsl:comment><xsl:comment> /com.omniupdate.ob </xsl:comment></div>
    </xsl:template>
    
    <!-- OUC Dynamic 3rd Level Tagging template match -->
    
    <!-- Create a variable that applies multiple body classes depending on the appearance of the page -->
    <xsl:variable name="bodyClasses"><!-- define your own bodyClasses variable here-->TheKitchenSink</xsl:variable>		
    
    <xsl:template match="ouc:div" mode="copy">
        <xsl:choose>
            <!-- Don't write the ouc:div during compare -->
            <xsl:when test="$ou:action='cmp'">
                <xsl:apply-templates select="node()" mode="copy" /> 
            </xsl:when>	
            <xsl:otherwise>
                <!-- Rewrite the tag, its attributes, and add the wysiwyg attribute with the contents bodyClasses variable -->
                <!-- Copy the content following the ouc:div tag, which will then trigger any required template matches  -->
                <ouc:div>
                    <xsl:attribute name="wysiwyg-class"><xsl:value-of select="$bodyClasses"/></xsl:attribute>						
                    <xsl:apply-templates select="attribute() | node()" mode="copy" />
                </ouc:div>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>			
    
    <!-- Include and Additional Content -->
    <!-- <xsl:template name="include-additional">
			
			<xsl:variable name="show-include" select="ou:assignVariable('show-include','no')"/>			
			<xsl:variable name="include-file" select="concat($domain,ou:pcfparam('include-file'))"/>
			
			<xsl:if test="$show-include='yes' and (string-length($include-file) > 0)">					
				<xsl:value-of select="if (unparsed-text-available($include-file)) then (unparsed-text($include-file,'UTF-8')) else 'The file could not be read.'" disable-output-escaping="yes"/>
			</xsl:if>
			
			<xsl:if test="ou:pcfparam('additional-content')='yes'">
				<xsl:apply-templates select="/*:document/content/additional-content/node()" mode="copy"/>
			</xsl:if>
				
		</xsl:template> -->
    
    
    <!-- in case not defined in pagetype xsl -->
    <xsl:template name="page-content"><p>No template defined.</p></xsl:template>
    
    <xsl:template name="common-top-navigation">
        <xsl:choose>
            <xsl:when test="not($ouc:action='pub')">
                <xsl:value-of select="unparsed-text(concat($ouc:httproot,'_resources/includes/top-nav.inc'), 'utf-8')" disable-output-escaping="yes"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:copy-of select="ou:standardInclude('/_resources/includes/top-nav.inc')"/>
            </xsl:otherwise>
        </xsl:choose>
        
    </xsl:template>
    
    
</xsl:stylesheet>
