<?xml version="1.0"?>
<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="d:/oexml/test_lov/test_lov2.xsl"> 
<xsl:output method="xml" encoding="UTF-16"/>
	<func:function name="Ext:transform_lov">
		<xsl:param name="Node"/>
		<xsl:variable name="value-pick" select="document('d:/oexml/test_lov/eai_value_map.xml')/root"/>
		<xsl:variable name="Interface_Direction" select="'Siebel Inbound'"/>
		<xsl:template match="$Node">
			<xsl:variable name="LOV_String" select="name(*[starts-with(name(), 'LOV')])"/>
			<xsl:variable name="LOV_Field" select="substring-after($LOV_String,'__')"/>
			<xsl:variable name="LOV_Type" select="substring($LOV_String,5,string-length($LOV_String) - 4 - string-length($LOV_Field)-2)"/>
			<xsl:variable name="LOV_Value" select="*[starts-with(name(), 'LOV')]"/>
			<xsl:variable name="Transformed_Value" select="$value-pick/row[Direction = $Interface_Direction and Type = $LOV_Type and External_System_Value = $LOV_Value]/Siebel_Value"/>
			<func:result select="$Transformed_Value"/>
		</xsl:template>	
	</func:function>
	<xsl:template match="/">
		<a:SiebelMessage>
			<xsl:attribute name="IntObjectFormat">
				<xsl:value-of select="b:OEXML/Header/InitiatingMessageID"/>
			</xsl:attribute>
			<xsl:attribute name="MessageId">
				<xsl:for-each select="b:OEXML/Header/NameValuePair/Name">
					<xsl:if test=". = 'MessageID'">
						<xsl:value-of select="../Value"/>
					</xsl:if>
				</xsl:for-each>
			</xsl:attribute>
			<xsl:attribute name="IntObjectName">
				<xsl:value-of select="Ext:transform_lov(b:OEXML/Header/LOV_Back_Office_Region__ConversationID)"/>
				<xsl:value-of select="b:OEXML/Header/LOV_Back_Office_Region__ConversationID"/>
			</xsl:attribute>
		</a:SiebelMessage>
	</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="no" externalpreview="no" url="file:///d:/oexml/test_lov/test_a1.xml" htmlbaseurl="" outputurl="file:///d:/oexml/test_lov/test_xx.xml" 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="..\dest.xsd" destSchemaRoot="SiebelMessage" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no" ><SourceSchema srcSchemaPath="..\oexml_r1.xsd" srcSchemaRoot="OEXML" AssociatedInstance="file:///d:/oexml/test_a1.xml" loaderFunction="document" loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template match="/"><block path="a:SiebelMessage/xsl:attribute[1]/xsl:for&#x2D;each/xsl:if/=[0]" x="217" y="70"/><block path="a:SiebelMessage/xsl:attribute[1]/xsl:for&#x2D;each/xsl:if" x="263" y="72"/></template></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->