<?xml version="1.0" encoding="UTF-8" ?>
<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:ouc="http://omniupdate.com/XSL/Variables"
exclude-result-prefixes="xsl xs ou ouc">
	
	<!--	Importing files to acquire their functionality of templates and parameters. All imported templates and parameters have lower priority. 
	This makes it possible to define templates or parameters with the same name/match conditions and redefine their functionality.
	This XSL file is called first by the PCF file to guarantee that it will maintain the highest priority for all templates and parameters. -->
	<xsl:import href="../common.xsl" />
	<xsl:import href="blog-functions.xsl" />

	<!-- The template that will contain all of the specific HTML template transformations.  Called by common.xsl. -->
	<xsl:template name="page-content">
		<xsl:comment> main </xsl:comment>
		 <div class="content" id="maincontent">
			<xsl:comment> container</xsl:comment>		
			<div class="container">
				<div class="row">
                 <div class="col p-md-0">
					<xsl:comment> breadcrumbs </xsl:comment>			
					<xsl:call-template name="breadcrumb">
					<xsl:with-param name="path" select="$ou:dirname"/>								
				</xsl:call-template>
				 </div>
                 </div>
				<div class="row">
				<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:if>
				</div>
				<div class="row">			
					<xsl:choose>
    <xsl:when test="$pageColumns='1'">
        <div class="col-12">
					<xsl:comment> content </xsl:comment>
					<section id="mainheader">
						<xsl:apply-templates select="mainheader/node()" mode="copy"/>
					</section>
					<section id="content">
						
						<br/>
						<h1><xsl:value-of select="replace(post-info/ouc:div[@label='post-title'],'//','&lt;br/&gt;')" disable-output-escaping="yes" /></h1>
						<p class="author">by <xsl:value-of select="post-info/ouc:div[@label='post-author']" /> - <xsl:value-of select="ou:displayLongDate(post-info/ouc:div[@label='post-date'])" /></p>
						<xsl:apply-templates select="content/middle/node()" mode="copy"/>
						<xsl:if test="ouc:properties[@label='config']/parameter[@name='disqus-enable']/option[@value='true']/@selected='true'">
							<div id="disqus_thread"></div>
<script type="text/javascript">

/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'zztestcomments'; // required: replace example with your forum shortname 

// The following are highly recommended additional parameters. Remove the slashes in front to use.
var disqus_url = page_id; //'[URL TO THE RESULTANT PAGE]'

/* * * DON'T EDIT BELOW THIS LINE * * */

(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();

</script>

<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>

						</xsl:if>
					</section>
		</div>
    </xsl:when>  
	<xsl:when test="$pageColumns='2'">
			<xsl:comment> two-columns </xsl:comment>												
			<!-- BEGIN LEFT COLUMN -->
			<div class="col-lg-3 p-md-0" id="sidebar">		
                <xsl:comment> sidebar </xsl:comment>
                <h3 class="side-nav-heading"><xsl:value-of select="$navigationTitle"/></h3>
                <nav class="navbar navbar-expand-lg navbar-light">
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse" id="navbarToggler">
                            <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>

                </div>
            </nav>		
			<xsl:comment> contact-block </xsl:comment>
			<xsl:apply-templates select="content/below-left-nav/node()" mode="copy"/>
		
					</div>
						<!-- MIDDLE CONTENT -->
					<div class="col-lg-9 pl-md-5 mb-4">
					<xsl:comment> content </xsl:comment>
					<section id="mainheader">
						<xsl:apply-templates select="mainheader/node()" mode="copy"/>
					</section>
					<section id="content">
						
						<br/>
						<h1><xsl:value-of select="replace(post-info/ouc:div[@label='post-title'],'//','&lt;br/&gt;')" disable-output-escaping="yes" /></h1>
						<p class="author">by <xsl:value-of select="post-info/ouc:div[@label='post-author']" /> - <xsl:value-of select="ou:displayLongDate(post-info/ouc:div[@label='post-date'])" /></p>
						<xsl:apply-templates select="content/middle/node()" mode="copy"/>
						<xsl:if test="ouc:properties[@label='config']/parameter[@name='disqus-enable']/option[@value='true']/@selected='true'">
							<div id="disqus_thread"></div>
<script type="text/javascript">

/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'zztestcomments'; // required: replace example with your forum shortname 

// The following are highly recommended additional parameters. Remove the slashes in front to use.
var disqus_url = page_id; //'[URL TO THE RESULTANT PAGE]'

/* * * DON'T EDIT BELOW THIS LINE * * */

(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();

</script>

<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>

						</xsl:if>
					</section>
					<!-- END MIDDLE CONTENT -->
					</div>
	</xsl:when>  
	<xsl:otherwise>
					<xsl:comment> two-columns </xsl:comment>												
			<!-- BEGIN LEFT COLUMN -->
			<div class="col-lg-3 p-md-0" id="sidebar">		
                <xsl:comment> sidebar </xsl:comment>
                <h3 class="side-nav-heading"><xsl:value-of select="$navigationTitle"/></h3>
                <nav class="navbar navbar-expand-lg navbar-light">
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse" id="navbarToggler">
                            <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>

                </div>
            </nav>		
			<xsl:comment> contact-block </xsl:comment>
			<xsl:apply-templates select="content/below-left-nav/node()" mode="copy"/>
		
					</div>
						<!-- MIDDLE CONTENT -->
					<div class="col-lg-6 pl-md-5 pr-md-5 mb-4">
					<xsl:comment> content </xsl:comment>
					<section id="mainheader">
						<xsl:apply-templates select="mainheader/node()" mode="copy"/>
					</section>
					<section id="content">
						
						<br/>
						<h1><xsl:value-of select="replace(post-info/ouc:div[@label='post-title'],'//','&lt;br/&gt;')" disable-output-escaping="yes" /></h1>
						<p class="author">by <xsl:value-of select="post-info/ouc:div[@label='post-author']" /> - <xsl:value-of select="ou:displayLongDate(post-info/ouc:div[@label='post-date'])" /></p>
						<xsl:apply-templates select="content/middle/node()" mode="copy"/>
						<xsl:if test="ouc:properties[@label='config']/parameter[@name='disqus-enable']/option[@value='true']/@selected='true'">
							<div id="disqus_thread"></div>
<script type="text/javascript">

/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'zztestcomments'; // required: replace example with your forum shortname 

// The following are highly recommended additional parameters. Remove the slashes in front to use.
var disqus_url = page_id; //'[URL TO THE RESULTANT PAGE]'

/* * * DON'T EDIT BELOW THIS LINE * * */

(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();

</script>

<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>

						</xsl:if>
					</section>
					<!-- END MIDDLE CONTENT -->
					</div>
        <xsl:comment> aside </xsl:comment>
					<aside class="col-lg-3">						
						<xsl:apply-templates select="content/right/node()" mode="copy"/>		
					</aside>
	</xsl:otherwise>
</xsl:choose>


				</div>
			</div><!-- end container -->
		</div><!-- end main -->
	</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')">
		<div class="row">
			<xsl:choose>
				<xsl:when test="$pageColumns='1' or $pageColumns='2'">
					<div class="col-lg-6">
						<xsl:apply-templates select="column[1]/node()" mode="copy"/>
					</div>
					<div class="col-lg-6">
						<xsl:apply-templates select="column[2]/node()" mode="copy"/>
					</div>
				</xsl:when>
				<xsl:otherwise>
					<div class="col-12">
					<xsl:apply-templates select="column[1]/node()" mode="copy"/>
					</div>
				</xsl:otherwise>
			</xsl:choose>
		</div>	
		
	</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:comment> content-bottom </xsl:comment>
		<div class="section-bg">
		 <div class="container">
			   <div class="row">
                   <div class="col-12">
						<xsl:apply-templates select="node()" mode="copy"/>	
				   </div>
			 </div>
			</div>
		</div>
	</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:if test="contains($pageOptions,'displayContactBox')">
	<xsl:comment> contact-block </xsl:comment>
			<div class="card contact mt-5 mb-5">
			  		<div class="card-body">
						<span class="fas fa-info-circle"></span>
			<xsl:apply-templates select="node()" mode="copy"/>
		
				</div></div>
		</xsl:if>
	</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>
