<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd">
<!-- 
RSS Archive Builder - Move into XSL folder to use
Constructs the RSS Archive Index and the page for each Month
Note: If there are no news items for a certain month, nothing will be displayed.

Contributors: Your Name here
Last Updated: 4/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="common.xsl"/> -->
				
		<xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
		
		<xsl:variable name="rss-feed" select="ou:assignVariable('rss-feed',$ou:feed,'http://omniupdate.com/syndication/aggregate.xml')"/>			
		<xsl:param name="folder-name" select="if(dirname='/') then '2013' else (ou:current_folder($ou:dirname))"/>		
		<xsl:variable name="rss-year" select="ou:assignVariable('rss-year',xs:integer($folder-name))"/>


		<xsl:template name="page-content">
		
		<!-- see breadcrumbs xsl -->
		<!-- <div id="breadcrumb"> 
		<xsl:call-template name="breadcrumb">
			<xsl:with-param name="path" select="$ou:dirname"/>								
		</xsl:call-template>
		</div> -->
			
			<div id="body_text">
		
					<xsl:apply-templates select="content/maincontent/node()" mode="copy" />
					<!-- Archive Builder. IMPORTANT: Modify HTML to match Client's specification or style -->
					<xsl:choose>
						<xsl:when test="(substring-before($ou:filename,'.'))= $index-file">
							<xsl:for-each select="$months">
								<xsl:variable name="cur_month" select="."/>
								<xsl:for-each select="$months_map">
									<xsl:if test="$cur_month = normalize-space(substring-before(.,':'))">									
										<div class="year">
											<strong style="color:#000"><xsl:value-of select="substring-after(.,':')"/></strong>
										</div>	
									</xsl:if>
								</xsl:for-each>
								<div class="month">
									<xsl:comment>Comment</xsl:comment>
									<xsl:for-each select="ou:rss-by-month-year($rss-feed,$rss-year,.)">										
										<p>
											<strong><a href="{./link}"><xsl:copy-of select="./title/node()"/></a> ( <xsl:copy-of select="./month/node()"/>&nbsp;<xsl:copy-of select="./date/node()"/> )</strong>
											
										</p>									
									</xsl:for-each>
								</div>
							</xsl:for-each>	
						</xsl:when>
						<xsl:otherwise>	
							<xsl:for-each select="ou:rss-by-month-year($rss-feed,$rss-year,normalize-space(xs:string(ou:capital(substring-before($ou:filename,'.')))))">
								<p>
									<strong>
										<a href="{./link}"><xsl:copy-of select="./title/node()"/></a>
										( <xsl:copy-of select="./date/node()"/>&nbsp;<xsl:copy-of select="./month/node()"/> )
									</strong>
								</p>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>												
					<!-- End Archive Builder -->
					
					<!-- <xsl:call-template name="include-additional"/> -->
					
			</div>
			
		</xsl:template>			
		
		

		
</xsl:stylesheet>
