	<!--
       ###################################################################
	Change the format of LOCACTIVITYGROUPS from a ':' delimited string to the
	structured format expected by the driver shim
	###################################################################
       -->
	<xsl:template match="value[ancestor::*/@attr-name='LOCACTIVITYGROUPS']">
		<xsl:variable name="locAG">
			<xsl:value-of select="."/>
		</xsl:variable>
		<xsl:variable name="subSystem">
			<xsl:value-of select="substring-before($locAG, ':')"/>
		</xsl:variable>
		<xsl:variable name="role">
			<xsl:value-of select="substring-after($locAG, ':')"/>
		</xsl:variable>
		<xsl:if test="$subSystem != ''">
			<value timestamp="{@timestamp}" type="structured">
				<component name="SUBSYSTEM">
					<xsl:value-of select="$subSystem"/>
				</component>
				<component name="AGR_NAME">
					<xsl:value-of select="$role"/>
				</component>
			</value>
		</xsl:if>
	</xsl:template>
	<!--
       ###################################################################
	Change the format of LOCPROFILES from a ':' delimited string to the
	structured format expected by the driver shim
	###################################################################
       -->
	<xsl:template match="value[ancestor::*/@attr-name='LOCPROFILES']">
		<xsl:variable name="locProfile">
			<xsl:value-of select="."/>
		</xsl:variable>
		<xsl:variable name="subSystem">
			<xsl:value-of select="substring-before($locProfile, ':')"/>
		</xsl:variable>
		<xsl:variable name="profile">
			<xsl:value-of select="substring-after($locProfile, ':')"/>
		</xsl:variable>
		<xsl:if test="$subSystem != ''">
			<value timestamp="{@timestamp}" type="structured">
				<component name="SUBSYSTEM">
					<xsl:value-of select="$subSystem"/>
				</component>
				<component name="PROFILE">
					<xsl:value-of select="$profile"/>
				</component>
			</value>
		</xsl:if>
	</xsl:template>
	<!--
	###################################################################
	If we get a "from-merge" modify, add the driver's Logical System name to the request
	so we will get any events in SAP on the object published to the driver.
	###################################################################
	-->
	<xsl:template match="modify">
		<xsl:copy>
			<xsl:apply-templates select="@*"/>
			<xsl:apply-templates select="* | comment() | processing-instruction() | text()"/>
			<xsl:if test="ancestor-or-self::modify[@from-merge='true']">
				<modify-attr attr-name="LOCACTIVITYGROUPS">
					<add-value>
						<value>
							<component name="SUBSYSTEM">
								<xsl:value-of select="'DRVCLNT100'"/>
							</component>
							<component name="AGR_NAME">
								<xsl:value-of select="''"/>
							</component>
						</value>
					</add-value>
				</modify-attr>
			</xsl:if>
		</xsl:copy>
	</xsl:template>
