<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY amp   "&#38;">
<!ENTITY copy   "&#169;">
<!ENTITY gt   "&#62;">
<!ENTITY hellip "&#8230;">
<!ENTITY laquo  "&#171;">
<!ENTITY lsaquo   "&#8249;">
<!ENTITY lsquo   "&#8216;">
<!ENTITY lt   "&#60;">
<!ENTITY nbsp   "&#160;">
<!ENTITY quot   "&#34;">
<!ENTITY raquo  "&#187;">
<!ENTITY rsaquo   "&#8250;">
<!ENTITY rsquo   "&#8217;">
]>
<!-- 
Widget Example: Global Header Widget

This is an example widget that shows the usage of widget.xsl for the standard PCF to Include Global Header solution.

In some implementations, it may be unnecessary to override the page-content template. when applicable, override a template that is called within the page-content template.
Override <xsl:template name="publish-output"/> to output just the widget content.

Contributors: Akifumi Yamamoto
Last Updated: 2017/10/10
-->
<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"
				xmlns:xlink="https://www.w3.org/1999/xlink"
				xmlns:map="http://www.w3.org/2005/xpath-functions/map"
				xmlns:func="http://www.w3.org/2005/xpath-functions"
				expand-text="yes"
				exclude-result-prefixes="xs ou fn ouc xlink map func">

	<xsl:import href="widget.xsl"/>

	<xsl:param name="output"/>
	<xsl:template match="ouc:div/element()[not(starts-with(name(), 'ouc:'))]" priority="0"/>

	<xsl:mode name="copy" on-no-match="shallow-copy"/>

	<xsl:template name="template-headcode" expand-text="no">
		<xsl:if test="$not-pub">
			<style>
				table[class^="ou-"] { width: 100%; table-layout: fixed; }
				table[class^="ou-"]{ width: 100%; cursor: default; margin: 32px 0 !important; }

				table[class^="ou-"],
				table[class^="ou-"] td, 
				table[class^="ou-"] th, 
				table[class^="ou-"] caption {
				border-collapse: separate;
				border-spacing: 0px;
				border: 1px solid #d2d2d2;
				box-sizing: border-box;
				}

				table[class^="ou-"] thead tr th, 
				table[class^="ou-"] tbody tr th, 
				table[class^="ou-"] caption, 
				table[class^="ou-"] thead tr td { font-weight: 800; text-align: center; }

				table[class^="ou-"] thead tr th, 
				table[class^="ou-"] tbody tr th, 
				table[class^="ou-"] caption, 
				table[class^="ou-"] thead tr td, 
				table[class^="ou-"] tbody tr td{
				color: #000;
				font-size: 14px;
				padding-top: 10px;
				padding-bottom: 10px;
				padding-left: 5px;
				padding-right: 5px;
				vertical-align: top;
				}

				table[class^="ou-"] thead tr th, 
				table[class^="ou-"] tbody tr th, 
				table[class^="ou-"] caption {
				background: none repeat scroll 0 0 #f0f0f0;
				color: #333;
				font-weight: 600;
				font-size: 14px;
				}

				table[class^="ou-"] caption {
				font-size: 18px;
				text-align: center;
				background-image: linear-gradient(to bottom,#f9f9f9,#d3d3d3);
				margin: 0px;
				border-bottom: 0;
				caption-side: top;
				}
			</style>
		</xsl:if>
	</xsl:template>
	<xsl:template name="template-footcode"/>

	<!--
The mobile version of the header has a different publish output.
Create a new template match in addition to using the default publish-output template for the main header.
-->
	<xsl:template name="publish-output">
		<xsl:call-template name="body-code-search"/>
	</xsl:template>

	<xsl:template name="page-content">
		<main id="content">
			<section class="page-title-header">
				<div class="page-title-bar">
					<div class="container">
						<h1 class="page-title">Header Edit File</h1>
					</div>
				</div>
			</section>
			<section>
				<div class="main-page">
					<div class="container">
						<div class="row">
							<div class="col-md-12">
								<article>
									<div class="post hentry">
										<h2>How do I edit this page?</h2>
										<h3>Quick Link </h3>
										<p>Use the table in the editable region below to edit the Quicke links your</p>
										<p>The top editable row will create the section heading under the quick links title.  The text should be created as a link.  The system will remove the link tags during publish</p>
										<p>The bottom editable row will create the links under the section header.  This should be a list of links.  </p>
										<xsl:apply-templates select="ouc:div[@label='quick-links']" mode="copy"/>										

									</div>
								</article>
							</div>
						</div>
					</div>
				</div>
			</section>
		</main>
	</xsl:template>



	
	<xsl:template name="body-code-search" >
		<!-- 	<xsl:apply-templates select="ouc:div[@label='quick-links']"/> -->
		<xsl:apply-templates select="ouc:div[@label='quick-links']/element()[not(starts-with(name(), 'ouc:'))]"/>
	</xsl:template>


	
	<xsl:template match="table[@data-snippet='ou-search-quick-links']" expand-text="yes">
				
		<xsl:param name="links" select="tbody/tr[@data-name='top-row']/td[@data-name='link']"/>
		<xsl:param name="links-items" select="tbody/tr[@data-name='dropdown-items']/td[@data-name='dropdown']"/>

		

		<div class="search-wrapper">
			<div class="search-close">
				<div class="container">
					<div class="close-form">CLOSE <span class="fal fa-times close-button" role="button" aria-label="Close Search" tabindex="0"></span></div>
					<div class="swosu-search-form">
						<h2>Search </h2>
						<form action="/search/">
							<div class="row">
								<div class="col-10" id="cludo-search-form">
									<label for="search-box" class="sr-only">Search</label>
									<input  name="q" type="text" value="" id="search-box" placeholder="Find what you're looking for..." />
								</div>
								<div class="col-2">
									<button type="submit" class="last-tab"><span class="fal fa-search"><span class="sr-only">Open Search</span></span></button>
								</div>
							</div>
						</form>
						<hr/>
						<h2>Quick Links</h2>
						<div class="row" >
			<xsl:if test="$links[ou:get-value(.)]">
				
			
				<xsl:for-each select="$links">
					<xsl:variable name="value" select="ou:get-value(.)"/>
					<xsl:variable name="i" select="position()"/>
					<xsl:variable name="children" select="$links-items[$i]/ul[1]"/>

					<xsl:variable name="heading">
						<h4>
							<xsl:copy-of select="$value/node()|$value/attribute()[name() != 'href']"/>
						</h4>
					</xsl:variable>

					<xsl:if test="ou:get-value(.)">
						
						<xsl:choose>
							<xsl:when test="$children">
								<div class="col-md-4" style="margin-bottom:10px;">
									<xsl:copy-of select="$heading"/>
									<hr style="margin: .5rem 0;"/>
									<xsl:apply-templates select="$children" mode="linkcreation"/>
								</div>
							</xsl:when>
							<xsl:otherwise>
								<div class="col-md-4">
									
									<xsl:copy-of select="$heading"/>
									<hr style="margin:1rem 0;"/>
								<xsl:copy-of select="$links-items"/>
									
								</div>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:if>
				</xsl:for-each>
			
		</xsl:if>
						</div>
						
					</div>
				</div>
			</div>
			<xsl:text expand-text="no" disable-output-escaping="yes">
				&lt;script&gt;
				jQuery(function($) {
				$('.last-tab').keydown(function(e) {
				var code = e.keyCode || e.which;

				if (code === 9) {  
				e.preventDefault();
				$('.close-form').focus();
				}
				});
				});
				&lt;/script&gt;
			</xsl:text>


		</div>


	</xsl:template>
	
	

	<xsl:template match="ul" mode="linkcreation">
			<xsl:for-each select="li">
			<xsl:apply-templates select="a"/><br/>
					
					
			
			</xsl:for-each>
		
	</xsl:template>

</xsl:stylesheet>