<?xml version="1.0" encoding="utf-8"?>
<!--
**********************************************************************************
Overview: This XSLT searches and transforms specific elements in the source XML 
		  to target XML for both inbound and outbound interfaces. 
		  The types of transformation are as follows : 
		  1) LOV Transformation
		  2) Date Transformation

Author 	: Michael Kwee
Date 	: 2 Jan 2007

 
**********************************************************************************
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b="urn:OEXML:r1" xmlns:a="http://www.siebel.com/xml/OE%20EAI%20Obtain%20Standing%20Data" xmlns:func="http://exslt.org/functions" xmlns:Ext="Ext">
	<xsl:variable name="Message_Id" select="//@MessageId"/>
	<xsl:variable name="Doc_Path" select="//@EAIFS"/>
	<xsl:output method="xml" encoding="UTF-16"/>
	<!--
********************************************************************
Identify Interface Direction
********************************************************************
-->

	<xsl:variable name="total">
		<xsl:value-of select="count(/*/*/*/ListOfOeProvisioningTask-Integration/OeProvisioningTask-Integration)"/>
	</xsl:variable>
	<xsl:variable name="dummy" select="1"/>

	<!--
	********************************************************************
	Check for nodes that match the specified pattern. 
	********************************************************************
	-->
	<xsl:template name="main" match="*">
		<xsl:param name="dummy" select="$dummy"/>
		<xsl:copy>
			<xsl:choose>
				<xsl:when test="name()='OEServiceStatus'">
					<xsl:choose>
						<xsl:when test="/*/*/*/ListOfOeProvisioningTask-Integration/OeProvisioningTask-Integration[$dummy]/ListOfFsActivityStep/FsActivityStep[1]/OEEventCode!='0'">
							<xsl:value-of select="'Failed'"/>
						</xsl:when>
						<xsl:when test="/*/*/*/ListOfOeProvisioningTask-Integration/OeProvisioningTask-Integration[$dummy]/ListOfFsActivityStep/FsActivityStep[1]/OEEventCode='0'">
							<xsl:choose>
								<xsl:when test="/*/*/*/ListOfOeProvisioningTask-Integration/OeProvisioningTask-Integration[$dummy]/ListOfFsActivityStep/FsActivityStep[2]/OEEventCode!='0'">
									<xsl:value-of select="'Partially Successful'"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="'Successful'"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
					</xsl:choose>
					<xsl:apply-templates select="*"/>
					<!--<xsl:call-template name="main">-->
<!--				       	<xsl:with-param name="dummy" select="$dummy+1"/>
					</xsl:call-template>-->
				</xsl:when>
				<xsl:otherwise>
					<xsl:copy-of select="@*"/>
					<xsl:apply-templates select="*|text()"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:copy>
	</xsl:template>

	<!--			
	********************************************************************
	Template to count
	********************************************************************
	-->
	<xsl:template name="incrementValue1">
	  <xsl:param name="value"/>
	  <xsl:param name="switch"/>
	  <xsl:call-template name="incrementValue">
	    <xsl:with-param name="value" select="$value"/>
		<xsl:with-param name="switch" select="'off'"/>
	  </xsl:call-template>
	</xsl:template>

	<xsl:template name="incrementValue">
	  <xsl:param name="value"/>
	      <xsl:value-of select="$value+1"/>
	</xsl:template>
	<!--			
	********************************************************************
	Template to write Error Message
	********************************************************************
	-->
	<xsl:template name="Ext:xslt_error">
		<xsl:param name="Error_Msg"/>
		<xsl:value-of select="$Error_Msg"/>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="INT145_Resp.xml" htmlbaseurl="" outputurl="" processortype="internal" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->