<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd"> 
<!-- 
INTERIOR CONTENT PAGES for UAEX 2013 Implementation ~ Simple

In the PCF, Nodes are grouped in <middle> or <right> and depending on the layout, the surrounding HTML around <middle> nodes is different.

* Left Navigation will be displayed if the layout is set to 2 or 3 columns.
* <right> nodes are copied when the layout is set to 3 columns. The Right column always has the Contact and Related Links regions displayed.
* <middle> content templates are always applied, but Page Properties determine if the region is copied or not.
* Social Media will be on the top if the layout is set to 1 or 2 columns, and in the right column if the layout is set to 3 columns.

Note: Template Number / Layout Variation does not correspond with number of columns. For Example, Main Content Page 1 (Template 11) has 3 columns.

-->
<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="common.xsl"/>

	
	<xsl:template name="page-content">

		<xsl:comment> main </xsl:comment>
		<div id="main">

			<xsl:comment> container</xsl:comment>		
			<div class="container">
			
				<xsl:comment> breadcrumbs </xsl:comment>			
				<xsl:call-template name="breadcrumb">
					<xsl:with-param name="path" select="$ou:dirname"/>								
				</xsl:call-template>

				<xsl:if test="contains($pageOptions,'displayBackToLink')">
					<div class="backtoprevlevel">
						<xsl:apply-templates select="content/back-to/node()" mode="copy"/>					
					</div>
				</xsl:if>
						
				<xsl:if test="$pageColumns!='3'">
					<xsl:apply-templates select="content//social" mode="copy"/>
				</xsl:if>
				
							
					<xsl:comment> two-columns </xsl:comment>								
					<div id="two-columns" class="g3">									
					<!-- BEGIN LEFT COLUMN -->
					
					<xsl:if test="$pageColumns!='1'">
						<xsl:comment> sidebar </xsl:comment>			
						<aside id="sidebar">																						
								<xsl:comment> accordion-holder </xsl:comment>
								<nav class="accordion-holder">
									<h1><xsl:value-of select="$navigationTitle"/></h1>
									<xsl:comment> left navigation </xsl:comment>
									<xsl:call-template name="nav-builder">
										<xsl:with-param name="top-level" select="substring($navigationStart,1,string-length($navigationStart)-1)"/>
										<xsl:with-param name="path" select="$ou:dirname" />
										<xsl:with-param name="last_crumb" select="$ou:dirname" />
				             		</xsl:call-template>
								</nav>								
						</aside>
					</xsl:if>	
					<!-- END LEFT COLUMN -->
					
					<!-- BEGIN RIGHT COLUMN -->
					<xsl:if test="$pageColumns='3'">
					
					<xsl:comment> aside </xsl:comment>
					<aside class="aside">						
						<xsl:apply-templates select="content/right/node()" mode="copy"/>		
					</aside>
					</xsl:if>
					<!-- END RIGHT COLUMN -->
					
					<!-- MIDDLE CONTENT -->
					<xsl:comment> content </xsl:comment>
					<section id="content">					
						<xsl:apply-templates select="content/middle/node()" mode="copy"/>
					</section>	
					<!-- END MIDDLE CONTENT -->
					</div>
				
					<div class="cf"><!--clearfix--></div>
				
				
			</div><!-- end container -->
		</div><!-- end main -->

	</xsl:template>
	
	<!-- 
	
	BEGIN TEMPLATE MATCHES FOR EDITABLE REGIONS
		
	Content will be copied in order it appears in the PCF.
	
	-->
	
	<!-- SOCIAL ICONS -->
	<xsl:template match="social" mode="copy"><!-- give links special class -->	
		<xsl:if test="contains($pageOptions,'displaySocialMedia')">
			<xsl:choose>
				<xsl:when test="$pageColumns='3'">
					<div class="social-block">	
						<xsl:apply-templates select="node()" mode="copy"/>							
					</div>		
				</xsl:when>
				<xsl:otherwise>
					<div class="connection">
					<ouc:div><xsl:apply-templates select="ouc:div/attribute()" mode="copy"/>
					<xsl:apply-templates select="ouc:editor" mode="copy"/>
						<xsl:apply-templates select=".//ul" mode="copy"/>	
					</ouc:div>			
					</div>
				</xsl:otherwise>		
			</xsl:choose>	
		</xsl:if>	
	</xsl:template>

	<xsl:template match="social//ul" mode="copy">
		<xsl:choose>
			<xsl:when test="$pageColumns='3'">
				<ul class="social-networks">
					<xsl:apply-templates select="node()" mode="copy"/>
				</ul>							
			</xsl:when>
			<xsl:otherwise>
				<div class="connection">
				<ul>
					<xsl:apply-templates select="li" mode="copy"/>	
				</ul>
				</div>
			</xsl:otherwise>		
		</xsl:choose>	
	</xsl:template>

	<!-- MAIN CONTENT AND WORDPRESS -->
	<xsl:template match="maincontent" mode="copy">	
		<xsl:if test="contains($pageOptions,'displayMain')">
			<xsl:apply-templates mode="copy"/> <!-- copy everything normally -->				
		</xsl:if>		
		<!-- add special content -->
		<xsl:if test="contains($pageOptions,'displayExternalWordpress')">
			<xsl:call-template name="WordPress"/>
		</xsl:if>	
	</xsl:template>
	
	<!-- ONE AND TWO COLUMN IMAGE BLOCKS -->
	<xsl:template match="imageblocks" mode="copy">
	<xsl:if test="contains($pageOptions,'displayImageBlocks')">
	<section class="about-block cattle-block">
		<div class="container cf">
			<xsl:choose>
				<xsl:when test="$pageColumns='1' or $pageColumns='2'">
					<div class="column">
						<xsl:apply-templates select="column[1]/node()" mode="copy"/>
					</div>
					<div class="column">
						<xsl:apply-templates select="column[2]/node()" mode="copy"/>
					</div>
				</xsl:when>
				<xsl:otherwise>
					<xsl:apply-templates select="column[1]/node()" mode="copy"/>
				</xsl:otherwise>
			</xsl:choose>
		</div>	
	</section>	
		
	</xsl:if>		
	</xsl:template>
	
	<!-- BOTTOM CONTENT (SAME AS MAINCONTENT, BUT UNDERNEATH ANY OTHER NODES -->
	<xsl:template match="bottomcontent" mode="copy">
	<xsl:if test="contains($pageOptions,'displayBottom')">
		<xsl:apply-templates select="node()" mode="copy"/>		
	</xsl:if>			
	</xsl:template>	
	
	<!-- ADDITIONAL/MEDIA LINKS -->
	<xsl:template match="additional-links" mode="copy">
		<xsl:if test="contains($pageOptions,'displayAdditional')">
		<xsl:comment> content-section </xsl:comment>
		<div class="content-section">								
			<!-- re-use page #2 additional links -->
			<xsl:apply-templates select="node()" mode="copy"/>												
		</div>							
		</xsl:if>
	</xsl:template>
	
	<!-- CONTENT/PUBLICATION LINKS -->
	<xsl:template match="contentlinks" mode="copy">
	<xsl:if test="contains($pageOptions,'displayContentLinks')">
	<xsl:comment> content-section </xsl:comment>
	<div class="content-section">	
		<!-- two column conent/publication links -->							
		<xsl:apply-templates select="node()" mode="copy"/>								
	</div>		
	</xsl:if>		
	</xsl:template>
	
	<!-- CONTACT AND RIGHT COLUMN SOCIAL MEDIA -->
	<xsl:template match="contact" mode="copy">
	
	<xsl:comment> contact-block </xsl:comment>
		
		<section class="contact-block">
			
			<xsl:apply-templates select="node()" mode="copy"/>
		
		<!-- see template match below for social/ouc:div/ul below, that sets correct class to the social list in this region -->
		<xsl:apply-templates select="/document/content/social" mode="copy"/> <!-- back to social template match -->

		</section>
		
				
	</xsl:template>
	
	<!-- RELATED LINKS -->
	<xsl:template match="relatedlinks" mode="copy">
		
		<xsl:comment> related-links </xsl:comment>
		<nav class="related-links">
			<xsl:apply-templates select="node()" mode="copy"/>
		</nav>			
		
	</xsl:template>
	
	
	<xsl:template match="relatedlinks//ul" mode="copy">
	<ul>
		<xsl:apply-templates select="li[position()&lt;12]" mode="copy"/>
		<xsl:if test="li[12] and $ou:action!='pub'">
				<li><p class="omniupdate message error">System Message: Maximum number of links reached. Please enter no more than 11 links in this region.</p></li>
		</xsl:if>
	</ul>
	</xsl:template>

	


	

</xsl:stylesheet>
