<?xml version="1.0"?>
<!-- Created By Philippe Lottmann -->
<!-- version="1.0" -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:output method="html" indent="yes" />

	<!--****************************-->
	<!-- START VARIABLE DEFINITIONS -->
	<!--****************************-->
	<xsl:variable name="elementNameTerm">&#160;Name:&#160;</xsl:variable>
	<xsl:variable name="tableNameTerm">&#160;Name</xsl:variable>
	<xsl:variable name="startDiv">&lt;div style="position: relative; left: +0.6cm"&gt;</xsl:variable>
	<xsl:variable name="endDiv">&lt;/div&gt;</xsl:variable>
	<xsl:variable name="CarriageReturn">&lt;br&gt;</xsl:variable>
	<xsl:variable name="ComponentName">Component</xsl:variable>
	<xsl:variable name="NoParamsMessage">No Parameters Defined</xsl:variable>
	<!-- END VARIABLE DEFINITIONS -->

	<!--********************-->
	<!-- ROOT ELEMENT ENTRY -->
	<!--********************-->
	<xsl:template match="/">
		<xsl:apply-templates select="MetamergeConfig" />
	</xsl:template>

	<!--***********************************-->
	<!-- MAIN METAMERGE CONFIG ENTRY POINT -->
	<!--***********************************-->
	<xsl:template match="MetamergeConfig">
		<html>
			<title>AL CONFIGURATION REPORT</title>
			<head>
				<style type="text/css">
					&lt;!--

					h1.title { font: bold; text-align: center; text-transform: uppercase; text-decoration: underline; font: 28px arial }

					h1.folderTitle { border-style: inset; text-align: center; text-transform: uppercase; font: 26px arial bold}

					h1 { text-align: left; text-transform: uppercase; font: 26px arial bold; font-weight: 400 }

					h2 { text-align: left; font-style: italic bold; font: 24px arial; position: relative; left: 0.2cm }

					h3 { text-align: left; text-transform: uppercase; text-decoration: underline; font: small-caps 22px arial; position: relative; left: 0.4cm }

					h4 { text-align: left; text-decoration: underline; font: 20px arial; font-style: italic; position: relative; left: 0.6cm }

					h5 { text-align: left; text-transform: uppercase; font: 18px arial bold; position: relative; left: 0.8cm }

					h6 { text-align: left; font: 16px arial bold; text-decoration: underline; position: relative; left: 1.0cm }

					p.ALcontent { position: relative; margin-top: 0px; margin-bottom: 0px; left: 1.2cm; font-family: tahoma; font: 14px }

					p.information { position: relative; margin-top: 0px; margin-bottom: 0px; left: 1.2cm; font: 14px; font-family: times; font-style: italic}

					p.emphasisedInformation { position: relative; margin-top: 0px; margin-bottom: 0px; left: 1.2cm; font: 14px; font-family: times }

					p.userComment { position: relative; left: 1.2cm; font: 14px bold; font-family: arial }

					table { background-color: rgb(240, 240, 240); margin-top: 20px; margin-bottom: 20px; border: 1px solid black; margin-left: 1.2cm }

					tr { text-align: left; font: 12px arial; padding: 5px}

					tr.header { text-align: center; text-transform: uppercase; font: 14px arial bold; padding: 5px}

					td.header { text-align: center; text-transform: uppercase; font: 14px arial bold; padding: 5px}

					--&gt;
				</style>
			</head>
			<body>
				<h1 class="title">AL CONFIGURATION REPORT</h1>
				<xsl:apply-templates select="Folder|JavaProperties|JavaLibraries" />
			</body>
		</html>
	</xsl:template>

	<!--******************************************************-->
	<!-- JAVA PARAMETER-BASED CONFIGURATION ITEMS ENTRY POINT -->
	<!--******************************************************-->
	<xsl:template match="JavaProperties|JavaLibraries">
		<xsl:param name="Section">1</xsl:param>

		<xsl:if test="count(./*) &gt; 0">
			<h1 class="folderTitle">
				ITDI&#160;
				<xsl:value-of select="name()" />
			</h1>

			<xsl:call-template name="DisplayParametersTable" />
		</xsl:if>
	</xsl:template>

	<!--***************************************-->
	<!-- METAMERGE FOLDER ANALYSIS ENTRY POINT -->
	<!--***************************************-->
	<xsl:template match="Folder">
		<h1 class="folderTitle">
			ITDI FOLDER NAME:
			<xsl:value-of select="@name" />
		</h1>

		<xsl:choose>
			<xsl:when test="@name = 'AssemblyLines'">
				<!-- Parsing Assembly Lines -->
				<xsl:apply-templates select="AssemblyLine" />
			</xsl:when>

			<xsl:when test="@name = 'Connectors'">
				<!-- Parsing Connectors -->
				<xsl:apply-templates select="Connector" />
			</xsl:when>

			<xsl:when test="@name = 'Parsers'">
				<!-- Parsing Parsers -->
				<xsl:apply-templates select="Parser" />
			</xsl:when>

			<xsl:when test="@name = 'EventHandlers'">
				<!-- Parsing Parsers -->
				<xsl:apply-templates select="EventHandler" />
			</xsl:when>

			<xsl:when test="@name = 'Scripts'">
				<!-- Parsing Scripts -->
				<xsl:apply-templates select="Script" />
			</xsl:when>

			<xsl:when test="@name = 'ExternalProperties'">
				<!-- Parsing ExternalProperties -->
				<xsl:apply-templates select="ExternalProperties" />
			</xsl:when>

			<xsl:when test="@name = 'AttributeMaps'">
				<!-- Parsing Attribute Maps -->
				<xsl:apply-templates select="ALMap" />
			</xsl:when>

			<xsl:when test="@name = 'Functions'">
				<!-- Parsing Attribute Maps -->
				<xsl:apply-templates select="Function" />
			</xsl:when>

			<xsl:when test="@name = 'Config'">
				<!-- Parsing Attribute Maps -->
				<xsl:apply-templates select="LogConfig|InstanceProperties" />
			</xsl:when>

			<xsl:when test="@name = 'Includes'">
				<!-- Parsing Attribute Maps -->
				<xsl:apply-templates select="Include" />
			</xsl:when>

			<xsl:otherwise>
				<h3>Unknown Folder Type</h3>
			</xsl:otherwise>
		</xsl:choose>

		<!-- DEBUG FUNCTION -->
		<!-- <xsl:for-each select="descendant::*">
			<h2>DESCENDANT NAME: <xsl:value-of select="@name"/></h2>
			<h2>DESCENDANT TYPE: <xsl:value-of select="name()"/></h2>
			</xsl:for-each> -->
	</xsl:template>

	<!--********************************-->
	<!-- ASSEMBLY LINE DATA ENTRY POINT -->
	<!--********************************-->
	<xsl:template match="AssemblyLine">
		<xsl:param name="Section">1</xsl:param>
		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<xsl:call-template name="DisplayNonDescendingNodes" />

		<xsl:apply-templates select="Hooks|Settings[not(DeltaSettings)]|ContainerEF|
									 ContainerDF|CallReturn|LogConfig">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
		</xsl:apply-templates>
	</xsl:template>

	<!--****************************-->
	<!-- HOOKS ANALYSIS ENTRY POINT -->
	<!--****************************-->
	<xsl:template match="Hooks">
		<xsl:param name="Section">1</xsl:param>
		<xsl:if test="count(Hook) &gt; 0">

			<xsl:call-template name="DisplaySectionFormatedName">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section" />
				</xsl:with-param>
			</xsl:call-template>

			<xsl:call-template name="DisplayNonDescendingNodes" />

			<xsl:call-template name="Display3ColumnsTable">
				<xsl:with-param name="NodeName">Hook</xsl:with-param>
			</xsl:call-template>

		</xsl:if>
	</xsl:template>

	<!--************************-->
	<!-- CONNECTORS ENTRY POINT -->
	<!--************************-->
	<xsl:template match="Connector|Function">
		<xsl:param name="Section">1</xsl:param>
		<xsl:param name="LoopBranch">False</xsl:param>

		<xsl:choose>
			<xsl:when test="ConnectorMode = 'Script'">
				<xsl:if test="$LoopBranch = 'False'">
					<xsl:call-template name="DisplaySectionFormatedName">
						<xsl:with-param name="Section">
							<xsl:value-of select="$Section" />
						</xsl:with-param>
						<xsl:with-param name="AltName">Script Connector</xsl:with-param>
					</xsl:call-template>
				</xsl:if>

				<xsl:call-template name="DisplayNonDescendingNodes" />

				<table border="1">
					<tr class="header">
						<td>
							<b>Connector Script</b>
						</td>
					</tr>
					<tr>
						<td>
							<pre>
								<xsl:value-of select="ConnectorScript" />
							</pre>
						</td>
					</tr>
				</table>
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="$LoopBranch = 'False'">
					<xsl:call-template name="DisplaySectionFormatedName">
						<xsl:with-param name="Section">
							<xsl:value-of select="$Section" />
						</xsl:with-param>
					</xsl:call-template>
				</xsl:if>

				<xsl:call-template name="DisplayNonDescendingNodes" />

				<!-- for Function Connector -->
				<xsl:if test="name() = 'Function'">
					<xsl:call-template name="DisplayParametersTable" />
				</xsl:if>

				<xsl:apply-templates select="Configuration|AttributeMap|Parser|Hooks|LinkCriteria|
											 Schema|Reconnect">
					<xsl:with-param name="Section">
						<xsl:value-of select="$Section + 1" />
					</xsl:with-param>
				</xsl:apply-templates>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!--*************************************************-->
	<!-- PARAMETER-BASED CONFIGURATION ITEMS ENTRY POINT -->
	<!--*************************************************-->
	<xsl:template match="Configuration|Reconnect|Settings[not(DeltaSettings)]|
						 Script[not(ConnectorScript) or not (Scripts)]|Parser|
						 Logger|SandboxConfig|InstanceProperties|Include">
		<xsl:param name="Section">1</xsl:param>

		<xsl:if test="count(./*) &gt; 0">
			<xsl:call-template name="DisplaySectionFormatedName">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section" />
				</xsl:with-param>
			</xsl:call-template>

			<xsl:call-template name="DisplayNonDescendingNodes" />
			<xsl:call-template name="DisplayParametersTable" />
		</xsl:if>
	</xsl:template>

	<!--*******************-->
	<!-- ALMAP ENTRY POINT -->
	<!--*******************-->
	<xsl:template match="ALMap">
		<xsl:param name="Section">1</xsl:param>

		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<xsl:call-template name="DisplayNonDescendingNodes" />
		<xsl:apply-templates select="AttributeMap">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
		</xsl:apply-templates>
	</xsl:template>


	<xsl:template match="AttributeMap">
		<xsl:param name="Section">1</xsl:param>

		<xsl:if test="count(AttributeMapItem) &gt; 0">

			<xsl:call-template name="DisplaySectionFormatedName">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section" />
				</xsl:with-param>
			</xsl:call-template>

			<xsl:call-template name="DisplayNonDescendingNodes" />

			<xsl:call-template name="Display3ColumnsTable">
				<xsl:with-param name="NodeName">AttributeMapItem</xsl:with-param>
			</xsl:call-template>

		</xsl:if>
	</xsl:template>

	<!--********************-->
	<!-- SCHEMA ENTRY POINT -->
	<!--********************-->
	<xsl:template match="Schema">
		<xsl:param name="Section">1</xsl:param>

		<xsl:if test="count(SchemaItem) &gt; 0">
			<xsl:call-template name="DisplaySectionFormatedName">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section" />
				</xsl:with-param>
			</xsl:call-template>

			<xsl:call-template name="DisplayNonDescendingNodes" />

			<xsl:call-template name="Display3ColumnsTable">
				<xsl:with-param name="NodeName">SchemaItem</xsl:with-param>
			</xsl:call-template>

		</xsl:if>
	</xsl:template>

	<!--*******************-->
	<!-- BRANCH ENTRY POINT -->
	<!--*******************-->
	<xsl:template match="Branch">
		<xsl:param name="Section">1</xsl:param>
		<xsl:param name="LoopBranch">False</xsl:param>

		<xsl:if test="$LoopBranch = 'False'">
			<xsl:call-template name="DisplaySectionFormatedName">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section" />
				</xsl:with-param>
			</xsl:call-template>
		</xsl:if>

		<xsl:call-template name="DisplayNonDescendingNodes" />

		<table border="1">
			<tr align="CENTER" valign="TOP">
				<td class="header"><b>Branch Type</b></td>
				<td class="header"><b>Branch Attribute Name</b></td>
				<td class="header"><b>Branch Attribute Value</b></td>
			</tr>
			<xsl:for-each select="Conditions/BranchCondition">
				<tr align="CENTER" valign="TOP">
					<td rowspan="3">
						<xsl:value-of select="name()" />
					</td>
					<td>Condition</td>
					<td>
						<xsl:value-of select="concat(LeftHand,' ',Operator,' ',RightHand)" />
					</td>
				</tr>
				<tr>
					<td>Negate</td>
					<td>
						<xsl:value-of select="Negate" />
					</td>
				</tr>
				<tr>
					<td>CaseSensitive</td>
					<td>
						<xsl:value-of select="CaseSensitive" />
					</td>
				</tr>
			</xsl:for-each>
			<xsl:for-each select="ScriptCondition">
				<tr align="CENTER" valign="TOP">
					<td>
						<xsl:value-of select="name()" />
					</td>
					<td>
						<xsl:value-of select="name()" />
					</td>
					<td>
						<pre>
							<xsl:value-of select="." />
						</pre>
					</td>
				</tr>
			</xsl:for-each>
		</table>

		<xsl:apply-templates select="./Connector|./ALMap|./Branch|./Loop|./Function">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:apply-templates>

	</xsl:template>


	<!--**************************-->
	<!-- EVENTHANDLER ENTRY POINT -->
	<!--**************************-->
	<xsl:template match="EventHandler">
		<xsl:param name="Section">1</xsl:param>
		<xsl:param name="LoopBranch">False</xsl:param>

		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<xsl:call-template name="DisplayNonDescendingNodes" />

		<xsl:apply-templates select="Configuration|AttributeMap|LogConfig|ActionMaps/ActionMap">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
		</xsl:apply-templates>

	</xsl:template>


	<xsl:template match="ActionMap">
		<xsl:param name="Section">1</xsl:param>
		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<xsl:call-template name="DisplayNonDescendingNodes" />

		<xsl:apply-templates select="ActionsTrue|ActionsFalse|ActionsError">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
		</xsl:apply-templates>
	</xsl:template>


	<xsl:template match="ActionsTrue|ActionsFalse|ActionsError">
		<xsl:param name="Section">1</xsl:param>

		<xsl:if test="count(./*) &gt; 0">
			<xsl:call-template name="DisplaySectionFormatedName">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section" />
				</xsl:with-param>
			</xsl:call-template>

			<table border="1">
				<tr class="header">
					<td>
						<b>
							ActionItem
							<xsl:value-of disable-output-escaping="yes" select="$tableNameTerm" />
						</b>
					</td>
					<td>
						<b>Parameter Name</b>
					</td>
					<td>
						<b>Parameter Value</b>
					</td>
				</tr>
				<xsl:for-each select="ActionItem">

					<xsl:variable name="ActionItemName">
						<xsl:value-of select="name()" />
					</xsl:variable>
					<xsl:variable name="NumberOfParameters">
						<xsl:value-of select="count(parameter)" />
					</xsl:variable>

					<xsl:for-each select="parameter">
						<tr>
							<xsl:if test="position() = 1">
								<xsl:element name="td">
									<xsl:attribute name="rowspan">
										<xsl:value-of select="$NumberOfParameters" />
									</xsl:attribute>
									<xsl:value-of select="$ActionItemName" />
								</xsl:element>
							</xsl:if>

							<xsl:call-template name="DisplayParameterRowContents" />
						</tr>
					</xsl:for-each>
				</xsl:for-each>
			</table>

		</xsl:if>
	</xsl:template>


	<!--************************-->
	<!-- CALLRETURN ENTRY POINT -->
	<!--************************-->
	<xsl:template match="CallReturn">
		<xsl:param name="Section">1</xsl:param>
		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<xsl:call-template name="DisplayNonDescendingNodes" />

		<xsl:apply-templates select="AttributeMap|Schema">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
		</xsl:apply-templates>

	</xsl:template>


	<!--******************-->
	<!-- LOOP ENTRY POINT -->
	<!--******************-->
	<xsl:template match="Loop">
		<xsl:param name="Section">1</xsl:param>
		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<xsl:call-template name="DisplayNonDescendingNodes" />

		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
			<xsl:with-param name="AltName">Attribute Value Loop Configuration</xsl:with-param>
			<xsl:with-param name="NoAtName">True</xsl:with-param>
		</xsl:call-template>

		<table border="1">
			<tr align="CENTER" valign="TOP">
				<td class="header">Loop Attribute Name</td>
				<td class="header">Loop Attribute Value</td>
			</tr>
			<xsl:for-each select="WorkAttributeName|LoopAttributeName">
				<tr align="CENTER" valign="TOP">
					<td>
						<xsl:value-of select="name()" />
					</td>
					<td>
						<xsl:value-of select="." />
					</td>
				</tr>
			</xsl:for-each>
		</table>

		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
			<xsl:with-param name="AltName">Branch Loop Configuration</xsl:with-param>
			<xsl:with-param name="NoAtName">True</xsl:with-param>
		</xsl:call-template>

		<xsl:apply-templates select="Branch">
			<xsl:with-param name="LoopBranch">True</xsl:with-param>
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
		</xsl:apply-templates>

		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
			<xsl:with-param name="AltName">Connector Branch Configuration</xsl:with-param>
			<xsl:with-param name="NoAtName">True</xsl:with-param>
		</xsl:call-template>

		<xsl:apply-templates select="LoopInitOption" />

		<xsl:apply-templates select="Connector">
			<xsl:with-param name="LoopBranch">True</xsl:with-param>
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
		</xsl:apply-templates>

	</xsl:template>

	<!--***************************-->
	<!-- LINK CRITERIA ENTRY POINT -->
	<!--***************************-->
	<xsl:template match="LinkCriteria">
		<xsl:param name="Section">1</xsl:param>

		<xsl:if test="count(./*) &gt; 0">
			<xsl:call-template name="DisplaySectionFormatedName">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section" />
				</xsl:with-param>
			</xsl:call-template>

			<xsl:call-template name="DisplayNonDescendingNodes" />

			<xsl:apply-templates select="script">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section + 1" />
				</xsl:with-param>
			</xsl:apply-templates>

			<xsl:if test="count(./LinkCriteriaItem) &gt; 0 or count(./Script) &gt; 0">
				<table border="1">
					<tr align="CENTER" valign="TOP">
						<td class="header">Link Type</td>
						<td class="header">Link Values</td>
					</tr>
					<xsl:for-each select="LinkCriteriaItem">
						<tr align="CENTER" valign="TOP">
							<xsl:if test="position() = 1">
								<xsl:element name="td">
									<xsl:attribute name="rowspan">
										<xsl:value-of select="count(LinkCriteriaItem)" />
									</xsl:attribute>
									<xsl:value-of select="name()" />
								</xsl:element>
							</xsl:if>
							<td>
								<xsl:value-of select="concat(Attribute,' ',Operator,' ',Value)" />
							</td>
						</tr>
					</xsl:for-each>
					<xsl:for-each select="Script">
						<tr align="CENTER" valign="TOP">
							<td>
								<xsl:value-of select="name()" />
							</td>
							<td>
								<pre>
									<xsl:value-of select="." />
								</pre>
							</td>
						</tr>
					</xsl:for-each>
				</table>
			</xsl:if>
		</xsl:if>
	</xsl:template>

	<!--******************************-->
	<!-- AL DETAILS DISPLAY  FUNCTION -->
	<!--******************************-->
	<xsl:template match="ContainerEF|ContainerDF">
		<xsl:param name="Section">1</xsl:param>

		<xsl:if test="count(./*) &gt; 0">

			<xsl:choose>
				<xsl:when test="name() = ContainerEF">
					<xsl:call-template name="DisplaySectionFormatedName">
						<xsl:with-param name="Section">
							<xsl:value-of select="$Section" />
						</xsl:with-param>
						<xsl:with-param name="AltName">Entry Flow</xsl:with-param>
						<xsl:with-param name="NoAtName">True</xsl:with-param>
					</xsl:call-template>
				</xsl:when>
				<xsl:otherwise>
					<xsl:call-template name="DisplaySectionFormatedName">
						<xsl:with-param name="Section">
							<xsl:value-of select="$Section" />
						</xsl:with-param>
						<xsl:with-param name="AltName">Data Flow</xsl:with-param>
						<xsl:with-param name="NoAtName">True</xsl:with-param>
					</xsl:call-template>
				</xsl:otherwise>
			</xsl:choose>

			<xsl:call-template name="DisplaySectionFormatedName">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section + 1" />
				</xsl:with-param>
				<xsl:with-param name="AltName">Flow Representation</xsl:with-param>
				<xsl:with-param name="NoAtName">True</xsl:with-param>
			</xsl:call-template>
			<xsl:call-template name="DrawAL" />

			<xsl:call-template name="DisplaySectionFormatedName">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section + 1" />
				</xsl:with-param>
				<xsl:with-param name="AltName">Detailled Configuration</xsl:with-param>
				<xsl:with-param name="NoAtName">True</xsl:with-param>
			</xsl:call-template>
			<xsl:apply-templates select="./Connector|./ALMap|./Branch|./Loop|./Function">
				<xsl:with-param name="Section">
					<xsl:value-of select="$Section + 2" />
				</xsl:with-param>
			</xsl:apply-templates>

		</xsl:if>
	</xsl:template>


	<xsl:template match="LoopType">
		<p class="information">
			<xsl:value-of select="name()" />
			:
			<xsl:choose>
				<xsl:when test=". = 0">Conditional Loop</xsl:when>
				<xsl:when test=". = 1">Connector Loop</xsl:when>
				<xsl:when test=". = 2">Attribute Value Loop</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="." />
				</xsl:otherwise>
			</xsl:choose>

		</p>
	</xsl:template>

	<xsl:template match="LoopInitOption">
		<p class="information">
			<xsl:value-of select="name()" />
			:
			<xsl:choose>
				<xsl:when test=". = 0">Do Nothing</xsl:when>
				<xsl:when test=". = 1">Initialize and Select/Lookup</xsl:when>
				<xsl:when test=". = 2">Select/Lookup only</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="." />
				</xsl:otherwise>
			</xsl:choose>

		</p>
	</xsl:template>

	<!--****************************-->
	<!-- EXTERNAL PROPERTY TEMPLATE -->
	<!--****************************-->
	<xsl:template match="ExternalProperties">
		<xsl:param name="Section">1</xsl:param>

		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<table border="1">
			<tr class="header">
				<td>
					<b>Property Name</b>
				</td>
				<td>
					<b>Property Value</b>
				</td>
			</tr>
			<xsl:for-each select="./*">
				<tr>
					<td>
						<xsl:value-of select="name()" />
					</td>
					<td>
						<xsl:value-of select="." />
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>

	<!--*****************-->
	<!-- CONFIG TEMPLATE -->
	<!--*****************-->
	<xsl:template match="Config">
		<xsl:param name="Section">1</xsl:param>

		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<xsl:apply-templates select="InstanceProperties|LogConfig">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
		</xsl:apply-templates>
	</xsl:template>

	<!--********************-->
	<!-- LOGCONFIG TEMPLATE -->
	<!--********************-->
	<xsl:template match="LogConfig">
		<xsl:param name="Section">1</xsl:param>

		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<xsl:apply-templates select="Logger">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section + 1" />
			</xsl:with-param>
		</xsl:apply-templates>
	</xsl:template>

	<!--*****************************-->
	<!-- INSTANCEPROPERTIES TEMPLATE -->
	<!--*****************************-->
	<xsl:template match="InstanceProperties">
		<xsl:param name="Section">1</xsl:param>

		<xsl:call-template name="DisplaySectionFormatedName">
			<xsl:with-param name="Section">
				<xsl:value-of select="$Section" />
			</xsl:with-param>
		</xsl:call-template>

		<xsl:call-template name="DisplayParametersTable" />
	</xsl:template>

	<!--*******************************-->
	<!--*******************************-->
	<!--*******************************-->
	<!--*******************************-->
	<!--*******************************-->
	<!-- SPECIAL FUNCTION CONTENT HERE -->
	<!--*******************************-->
	<!--*******************************-->
	<!--*******************************-->
	<!--*******************************-->
	<!--*******************************-->


	<!--******************-->
	<!-- DRAW AL FUNCTION -->
	<!--******************-->
	<xsl:template name="DrawAL">
		<xsl:for-each select="./Branch|./Connector|./ALMap|./Loop|./Function">
			<p class="ALcontent">
			
				<xsl:choose>
					<xsl:when test="name() = 'Connector' and ./ConnectorMode = 'Script'">
						<b>
							<xsl:value-of select="./ConnectorMode" />
							<xsl:value-of select="concat(' ',$ComponentName)" />
						</b>
						:
						<xsl:value-of select="@name" />
					</xsl:when>
					<xsl:when test="name() = 'Function'">
						<b>
							<xsl:value-of select="name()" />
							<xsl:value-of select="concat(' ',$ComponentName)" />
						</b>
						:
						<xsl:value-of select="@name" />
					</xsl:when>
					<xsl:otherwise>
						<b>
							<xsl:value-of select="name()" />
						</b>
						:
						<xsl:value-of select="@name" />
					</xsl:otherwise>
				</xsl:choose>
				
				<xsl:if test="name() = 'Connector'">
					<i>
						(Mode:
						<xsl:value-of select="ConnectorMode" />
						; State:
						<xsl:value-of select="ConnectorState" />
						)
					</i>
				</xsl:if>

			</p>

			<xsl:if test="name() = 'Branch'">
				<xsl:value-of disable-output-escaping="yes" select="$startDiv" />
				<xsl:call-template name="DrawAL" />
				<xsl:value-of disable-output-escaping="yes" select="$endDiv" />
			</xsl:if>
		</xsl:for-each>
	</xsl:template>


	<!--******************************************************-->
	<!-- DISPLAY NON-DESCENDING, NON-PARAMETER NODES FUNCTION -->
	<!--******************************************************-->
	<xsl:template name="DisplayNonDescendingNodes">
		<xsl:for-each select="child::* [not(child::*) and 
										string-length(.) &gt; 0 and 
										not(name() = 'parameter') and
										not(name() = 'Script') and
										not(name() = 'ConnectorScript') and
										not(name() = 'ScriptCondition') and
										not(name() = 'Name')]">
			<xsl:choose>
				<xsl:when test="name() = 'UserComment'">
					<p class="userComment">
						<xsl:value-of select="name()" />
						:
						<xsl:value-of select="." />
					</p>
				</xsl:when>
				<xsl:when test="name() = 'ConnectorState' or
								name() = 'ConnectorMode' or
								name() = 'Enabled' or
								name() = 'InheritFrom'">
					<p class="emphasisedInformation">
						<xsl:value-of select="name()" />
						:
						<xsl:value-of select="." />
					</p>
				</xsl:when>
				<xsl:otherwise>
					<p class="information">
						<xsl:value-of select="name()" />
						:
						<xsl:value-of select="." />
					</p>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:template>

	<!--*****************************-->
	<!-- DISPLAY PARAMETERS FUNCTION -->
	<!--*****************************-->
	<xsl:template name="DisplayParametersTable">
		<xsl:choose>
			<xsl:when test="count(./parameter) &gt; 0">
				<table border="1">
					<tr class="header">
						<td>
							<b>Parameter Name</b>
						</td>
						<td>
							<b>Parameter Value</b>
						</td>
					</tr>
					<xsl:for-each select="parameter">
						<tr>
							<xsl:call-template name="DisplayParameterRowContents" />
						</tr>
					</xsl:for-each>
				</table>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="DisplayNoConfigInfoMessage" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>


	<xsl:template name="DisplayParameterRowContents">
		<td>
			<xsl:value-of select="@name" />
		</td>
		<td>
			<xsl:choose>
				<xsl:when test="@name = 'Script' or @name = 'script'">
					<pre>
						<xsl:value-of select="." />
					</pre>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="." />
				</xsl:otherwise>
			</xsl:choose>
		</td>
	</xsl:template>


	<!--*********************************-->
	<!-- DISPLAY 3-COLUMN TABLE FUNCTION -->
	<!--*********************************-->
	<xsl:template name="Display3ColumnsTable">
		<xsl:param name="NodeName" />

		<xsl:choose>
			<xsl:when test="count(./*[name()=$NodeName]) &gt; 0">
				<table border="1">
					<tr class="header">
						<td>
							<b>
								<xsl:value-of select="$NodeName" />
								<xsl:value-of disable-output-escaping="yes" select="$tableNameTerm" />

							</b>
						</td>
						<td>
							<b>Parameter Name</b>
						</td>
						<td>
							<b>Parameter Value</b>
						</td>
					</tr>
					<xsl:for-each select="./child::*[name()=$NodeName]">
						<xsl:variable name="attrsCount">
							<xsl:value-of select="count(*) - 1" />
						</xsl:variable>
						<xsl:variable name="attrName">
							<xsl:value-of select="Name" />
						</xsl:variable>

						<xsl:for-each select="*[not (name()='Name')]">

							<tr>
								<xsl:if test="position()=1">
									<xsl:element name="td">
										<xsl:attribute name="rowspan">
											<xsl:value-of select="$attrsCount" />
										</xsl:attribute>
										<xsl:value-of select="$attrName" />
									</xsl:element>
								</xsl:if>

								<td>
									<xsl:value-of select="name()" />
								</td>
								<td>
									<xsl:choose>
										<xsl:when test="name() = 'Script'">
											<pre>
												<xsl:value-of select="." />
											</pre>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="." />
										</xsl:otherwise>
									</xsl:choose>
								</td>
							</tr>
						</xsl:for-each>
					</xsl:for-each>
				</table>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="DisplayNoConfigInfoMessage" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>


	<!--**********************************-->
	<!-- SECTION NAME FORMATTING FUNCTION -->
	<!--**********************************-->
	<xsl:template name="DisplaySectionFormatedName">
		<xsl:param name="Section">1</xsl:param>
		<xsl:param name="NoAtName">False</xsl:param>
		<xsl:param name="AltName" />

		<xsl:variable name="SectionOpenFieldName">
			<xsl:value-of select="concat('&lt;h',$Section,'&gt;')" />
		</xsl:variable>
		<xsl:variable name="SectionCloseFieldName">
			<xsl:value-of select="concat('&lt;/h',$Section,'&gt;')" />
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="$Section &gt; 6">
				<xsl:value-of disable-output-escaping="yes" select="'&lt;h6&gt;'" />
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of disable-output-escaping="yes" select="$SectionOpenFieldName" />
			</xsl:otherwise>
		</xsl:choose>

		<xsl:choose>
			<xsl:when test="string-length($AltName) &gt; 0">
				<xsl:value-of select="$AltName" />
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="name()" />
			</xsl:otherwise>
		</xsl:choose>

		<xsl:if test="@name and $NoAtName='False'">
			<xsl:value-of disable-output-escaping="yes" select="$elementNameTerm" />
			<xsl:value-of select="@name" />
		</xsl:if>

		<xsl:if test="not(@name) and ./Name and $NoAtName='False'">
			<xsl:value-of disable-output-escaping="yes" select="$elementNameTerm" />
			<xsl:value-of select="./Name" />
		</xsl:if>

		<xsl:choose>
			<xsl:when test="$Section &gt; 6">
				<xsl:value-of disable-output-escaping="yes" select="'&lt;/h6&gt;'" />
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of disable-output-escaping="yes" select="$SectionCloseFieldName" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!--************************************************-->
	<!-- DISPLAY NO CONFIG INFORMATION MESSAGE FUNCTION -->
	<!--************************************************-->
	<xsl:template name="DisplayNoConfigInfoMessage">
		<p class="information">
			<xsl:value-of select="$NoParamsMessage" />
		</p>
	</xsl:template>

</xsl:stylesheet>