<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet>
<!--
Implementations v1 - 05/03/2018
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"
				xmlns="http://www.w3.org/1999/xhtml"
				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>

	<xsl:template match="ouc:div" mode="edit-button">
		<xsl:if test="$ou:action = 'edt'">
			<xsl:copy>
				<xsl:attribute name="wysiwyg-class" select="$body-class" />
				<xsl:apply-templates select="attribute()|ouc:editor" />
			</xsl:copy>
		</xsl:if>
	</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>

	<!-- Emergency Alert Styles -->
	<xsl:template match="p[@class='ou-green-alert']">
		<p class="borderMeGreen greenBackground displaynone"><span class="ui-icon-green ui-icon-circle-check">&#160;</span><xsl:apply-templates select="node()" /></p>
	</xsl:template>

	<xsl:template match="p[@class='ou-red-alert']">
		<p class="borderMeRed redBackground displaynone"><span class="ui-icon-red ui-icon-alert">&#160;</span><xsl:apply-templates select="node()" /></p>
	</xsl:template>

	<xsl:template match="p[@class='ou-grey-alert']">
		<p class="borderMeGray displaynone"><xsl:apply-templates select="node()" /></p>
	</xsl:template>

</xsl:stylesheet>
