<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet>
<!-- 
Implementations Skeletor v3 - 5/10/2014

IDENTITY TEMPLATE MATCH
This template ensures that all content is copied, or applied to any existing template matches. Edit sparingly.

Contributors: Your Name Here
Last Updated: Enter Date Here
-->
<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="xs ou fn ouc">
	
    <!-- 
    
    Identity Matches
    
    -->
    <!-- The following template matches all items except processing instructions, copies them, then processes any children. -->
    <xsl:template match="attribute()|text()|comment()" mode="copy">
        <xsl:copy />
    </xsl:template>
    
    <xsl:template match="element()" mode="copy">
        <xsl:element name="{name()}">
            <xsl:apply-templates select="attribute()|node()" mode="copy"/>
        </xsl:element>
    </xsl:template>
    
    <!-- The following template matches processing instructions, outputs the proper syntax with the code escaped properly. -->
    <xsl:template match="processing-instruction()" mode="copy">
        <xsl:processing-instruction name="php">
			<xsl:value-of select="." disable-output-escaping="yes" />
		?</xsl:processing-instruction>
    </xsl:template>
    
    <!--
       
    OUC Matches   
       
    -->
    
    <!-- OUC Dynamic 3rd Level Tagging -->
    <xsl:template match="ouc:div" mode="copy">
        <xsl:copy>
            <xsl:attribute name="wysiwyg-class"><xsl:value-of select="$bodyClass" />  <xsl:value-of select="$pageType"/> </xsl:attribute>
            <xsl:apply-templates select="attribute()|node()" mode="copy" />
        </xsl:copy>
    </xsl:template>
    <xsl:template match="ouc:*[$ou:action !='edt']" mode="copy">
        <xsl:apply-templates mode="copy" />
    </xsl:template>
    
    <!--
        
    MISC 
    
    -->
    
    <!-- Visual warning for broken dependencies tags -->
    <xsl:template match="a[contains(@href,'*** Broken')]" mode="copy">
        <a href="{@href}" style="color: red;"><xsl:value-of select="."/></a> <span style="color: red;">[BROKEN LINK]</span>
    </xsl:template>
    
    <!--

    Table Transformations 
    
    -->
    
    <xsl:template match="table[@class = 'ou-slideshow-images']" mode="copy">
        <div id="images">
            <xsl:apply-templates select="tbody/tr" mode="copy"/>
        </div>
        <script type="text/javascript" language="javascript">
            $('#images').coinslider({ width: 693, height: 340, spw: 1, sph: 1, effect: 'straight', delay: 15000 });
        </script>
    </xsl:template>
    
    <xsl:template match="table[@class = 'ou-slideshow-images']/tbody/tr" mode="copy">
        <xsl:variable name="row-number" as="xs:integer"><xsl:number/></xsl:variable>
        
        <xsl:if test="$row-number gt 1">
            <xsl:apply-templates select="td[1]/node()" mode="copy"/>
            <span><xsl:apply-templates select="td[2]/text()" mode="copy"/></span>
        </xsl:if>
    </xsl:template>
    
    <!-- 
    
    RSS Asset Transformation
    
    -->
    
    <xsl:template match="//ou_rss" mode="copy">
        <xsl:choose>
            <xsl:when test="$ou:action!='pub'">
                <!--custom xsl for staging here-->
                <h2>RSS feed will be displayed on publish.</h2><p>Example feed...</p>
                <ul id="bottom2list">
                    <li><a href='http://www.gallenauniversity.com/news/gallena_celebrates_1001.html'>Gallena University Celebrates 100 Years!</a></li>
                    <li><a href='http://www.gallenauniversity.com/news/alumni_fair.html'>Alumni Campus Fair</a></li>
                    <li><a href='http://www.gallenauniversity.com/news/study_abroad.html'>Study Abroad Informational Meeting</a></li>
                </ul>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text disable-output-escaping="yes">&lt;%</xsl:text>
                extURL = "<xsl:value-of select="./feed"/>"
                howManyresults = <xsl:value-of select="./items"/>
                <xsl:text>&#x0A;</xsl:text>
                <xsl:text disable-output-escaping="yes">%&gt;</xsl:text>
                <xsl:comment>#include virtual="/_resources/asp/sortdate.asp" </xsl:comment>
                <xsl:comment>#include virtual="/_resources/asp/rss_feed.asp" </xsl:comment>
                
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>   
    
    <xsl:template match="//ou_rss_landing" mode="copy">
        <xsl:choose>
            <xsl:when test="$ou:action!='pub'">
                <!--custom xsl for staging here-->
                <table border="0" cellpadding="0" cellspacing="0" width="620">
                    <tr>
                        <td width="154" valign="top"><strong>May 29, 2014</strong></td>
                        <td width="466" valign="top"><a href="#" title="San Diego City College Students">San Diego City College Students Awarded $10,000 Annual Scholarships from UC San Diego</a><br /><br /></td>
                    </tr>
                    <tr>
                        <td width="154" valign="top"><strong>May 28, 2014</strong></td>
                        <td width="466" valign="top"><a href="#" title="San Diego Community College District">San Diego Community College District Police</a><br /><br /></td>
                    </tr>
                    <tr>
                        <td width="154" valign="top"><strong>May 21, 2014</strong></td>
                        <td width="466" valign="top"><a href="#" title="San Diego City College">Nurse Pinning Ceremony Set for Saturday at San Diego City College</a><br /><br /></td>
                    </tr>
                </table>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>&#x0A;</xsl:text>
                <xsl:text disable-output-escaping="yes">&lt;%</xsl:text>
                extURL = "<xsl:value-of select="./feed"/>"
                howManyresults = <xsl:value-of select="./items"/>
                <xsl:text>&#x0A;</xsl:text>
                <xsl:text disable-output-escaping="yes">%&gt;</xsl:text>
                <xsl:comment>#include virtual="/_resources/asp/sortdate.asp" </xsl:comment>
                <xsl:comment>#include virtual="/_resources/asp/rss_feed_landing.asp" </xsl:comment>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template> 
    
</xsl:stylesheet>
