<?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;">
]>
<!-- 
Implementations Skeletor - 04/19/2016

STANDARD TEMPLATE MATCHES
Identity templates that recursively copies all content, or applies other applicable templates.
Also includes misc templates for standard implementations.

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()">
        <xsl:copy />
    </xsl:template>
    
    <xsl:template match="element()">
        <xsl:element name="{name()}">
            <xsl:apply-templates select="attribute()|node()"/>
        </xsl:element>
    </xsl:template>

    <!--
        
    MISC 
    
    -->
    
    <!-- don't output ouc tags on publish. -->
    <xsl:template match="ouc:*[$ou:action !='edt']">
        <xsl:apply-templates />
    </xsl:template>  
          
    <!-- Visual warning for broken dependencies tags -->
    <xsl:template match="a[contains(@href,'*** Broken')]">
        <a href="{@href}" style="color: red;"><xsl:value-of select="."/></a> <span style="color: red;">[BROKEN LINK]</span>
    </xsl:template>
    
    <!-- The following template matches processing instructions, outputs the proper syntax with the code escaped properly. -->
    <!-- Remove closing '?' mark if not HTML5 output. -->
    <xsl:template match="processing-instruction('php')">
        <xsl:processing-instruction name="php">
			<xsl:value-of select="." disable-output-escaping="yes" />
		?</xsl:processing-instruction>
    </xsl:template>
    
    <xsl:template match="ouc:div[not($ou:action='edt')]" mode="button"/>
    <xsl:template match="ouc:div[$ou:action='edt']" mode="button">
        <ouc:div>
            <xsl:apply-templates select="attribute()|ouc:editor"/>
        </ouc:div>
    </xsl:template>
    
    <xsl:template match="ouc:div" mode="nobutton">
        <xsl:apply-templates select="node()"/>
    </xsl:template>
    
    <!-- Table Transformations - Snippet -->
    <xsl:template match="table[@class='ou-social-media-twitter']">
        <xsl:for-each select="tbody/tr">
            <div class="twidget">
                <xsl:value-of select="td[1]/node()"/><br/>
                <a class="twitter-timeline" href="{td[2]/node()}" data-widget-id="{td[3]/node()}" data-tweet-limit="{td[4]/node()}" ><xsl:value-of select="td[5]/node()"/></a>
                <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
            </div> 
        </xsl:for-each>
    </xsl:template>
    
    <xsl:template match="table[@class='ou-social-media-icons']">
        <div id="social">
            <xsl:for-each select="tbody/tr">
                    <xsl:apply-templates select="td/node()"/>
            </xsl:for-each>
        </div>
    </xsl:template>
        
</xsl:stylesheet>
