<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:output method="xml" indent="no"/>
	
	<xsl:template match="globalnav">
		<xsl:for-each select="page">
			<li><a href="pag_xml.php?id={@id}"><xsl:value-of select="document(concat('pag_xml.php?id=', @id))/page/name"/></a></li>
		</xsl:for-each>
	</xsl:template>
	
	<xsl:template match="sitenav">
		<xsl:for-each select="page">
			<li class="t{position()}"><a href="pag_xml.php?id={@id}"><xsl:value-of select="document(concat('pag_xml.php?id=', @id))/page/name"/></a></li>
		</xsl:for-each>
	</xsl:template>
	
	<xsl:template name="sidenav">	
		<xsl:for-each select="document(concat('sit_xml.php?id=', $parentsite))/site/prc/navigation/*[name()=$navtype]/page[@id=$primarypage]/page">
		<xsl:element name="li">
		<xsl:attribute name="class">
		<xsl:if test="@id = $secondarypage">on</xsl:if>
		</xsl:attribute>
		<a href="javascript:swap_ses('ses{position()}')"><img src="images/arrow_sub_off.gif"/></a><a href="pag_xml.php?id={@id}" class="nav"><xsl:value-of select="document(concat('pag_xml.php?id=', @id))//page/name"/></a>
			<xsl:if test="page">
				<xsl:element name="ul">
				<xsl:attribute name="class">tertiary</xsl:attribute>
				<xsl:attribute name="id">ses<xsl:value-of select="position()"/></xsl:attribute>
				<xsl:choose>
				<xsl:when test="@id = $currentpage | @id = $secondarypage"><xsl:attribute name="style">display: block;</xsl:attribute></xsl:when>
				<xsl:otherwise><xsl:attribute name="style">display: none;</xsl:attribute></xsl:otherwise>
				</xsl:choose>					
				<xsl:for-each select="page">
				<xsl:element name="li">
				<xsl:attribute name="class">
				<xsl:if test="@id = $currentpage">on</xsl:if>
				</xsl:attribute><a href="pag_xml.php?id={@id}"><img src="images/arrow_sub_off.gif"/></a><a href="pag_xml.php?id={@id}" class="nav"><xsl:value-of select="document(concat('pag_xml.php?id=', @id))/page/name"/></a></xsl:element>
				</xsl:for-each>
			</xsl:element></xsl:if></xsl:element>
		</xsl:for-each>
	</xsl:template>
	
	<xsl:template match="quicknav">		
		<fieldset>
			<h3><label for="audiences"><xsl:value-of select="name"/></label></h3>
			<select id="audiences">
				<xsl:for-each select="page">
				<option value=""><xsl:value-of select="document(concat('pag_xml.php?id=', @id))/page/name"/></option>
				</xsl:for-each>
			</select><button type="button">Go</button>
		</fieldset>
	</xsl:template>
	
	<xsl:template match="utilitynav">
		<ul>
			<xsl:for-each select="document(concat('sit_xml.php?id=', $parentsite))/site/prc/navigation/utilitynav/page">
			<li><a href="pag_xml.php?id={@id}"><xsl:value-of select="document(concat('pag_xml.php?id=', @id))/page/name"/></a></li>
			</xsl:for-each>
		</ul>
	</xsl:template>
	
</xsl:stylesheet>

