|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<xsl:stylesheet version="3.0"
|
|
xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:err="http://www.w3.org/2005/xqt-errors"
|
|
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
xmlns:fwkmapping="http://www.loreal.com/hip/fwk/mapping/FwkMapping"
|
|
xmlns:document="http://www.loreal.com/hip/fwk/mapping/Document"
|
|
xmlns:invocationContext="http://www.loreal.com/hip/fwk/mapping/InvocationContext"
|
|
xmlns:property="http://www.loreal.com/hip/fwk/common/Property"
|
|
xmlns:header="http://www.loreal.com/hip/fwk/mapping/Header" xmlns:csv="http://www.loreal.com/hip/fwk/xsl/csv"
|
|
xmlns:cf="http://www.loreal.com/hip/fwk/mapping/customfunctions"
|
|
xmlns:saxon="http://saxon.sf.net/" exclude-result-prefixes="csv fn xs xsl cf saxon">
|
|
|
|
<xsl:output method="xml" encoding="UTF-8" byte-order-mark="no"
|
|
indent="yes" />
|
|
|
|
|
|
<!-- [Document] -->
|
|
<xsl:param name="input-data-type" select="'json'"
|
|
as="xs:string" /><!-- csv, json or xml -->
|
|
<xsl:param name="input-data-csv-field-separator" select="''"
|
|
as="xs:string" />
|
|
<xsl:param name="input-data-csv-line-separator" select="''"
|
|
as="xs:string" />
|
|
<xsl:param name="output-data-type" select="'json'"
|
|
as="xs:string" /><!-- csv, json or xml -->
|
|
<xsl:param name="output-data-csv-field-separator" select="''"
|
|
as="xs:string" />
|
|
<xsl:param name="output-data-csv-line-separator" select="''"
|
|
as="xs:string" />
|
|
|
|
|
|
<!-- [Transient] -->
|
|
<xsl:param name="input-transient-data-type" select="'xml'"
|
|
as="xs:string" /><!-- csv, json or xml -->
|
|
<xsl:param name="input-transient-data-csv-field-separator"
|
|
select="''" as="xs:string" />
|
|
<xsl:param name="input-transient-data-csv-line-separator"
|
|
select="''" as="xs:string" />
|
|
<xsl:param name="output-transient-data-type" select="'xml'"
|
|
as="xs:string" /><!-- csv, json or xml -->
|
|
<xsl:param name="output-transient-data-csv-field-separator"
|
|
select="''" as="xs:string" />
|
|
<xsl:param name="output-transient-data-csv-line-separator"
|
|
select="''" as="xs:string" />
|
|
|
|
|
|
<!-- [InvocationRequest] -->
|
|
<xsl:param name="input-invocation-request-data-type" select="'xml'"
|
|
as="xs:string" /><!-- csv, json or xml -->
|
|
<xsl:param name="input-invocation-request-data-csv-field-separator"
|
|
select="''" as="xs:string" />
|
|
<xsl:param name="input-invocation-request-data-csv-line-separator"
|
|
select="''" as="xs:string" />
|
|
<xsl:param name="output-invocation-request-data-type" select="'xml'"
|
|
as="xs:string" /><!-- csv, json or xml -->
|
|
<xsl:param name="output-invocation-request-data-csv-field-separator"
|
|
select="''"
|
|
as="xs:string" />
|
|
<xsl:param name="output-invocation-request-data-csv-line-separator"
|
|
select="''" as="xs:string" />
|
|
|
|
<!-- [InvocationResponse] -->
|
|
<xsl:param name="input-invocation-response-data-type" select="'xml'"
|
|
as="xs:string" /><!-- csv, json or xml -->
|
|
<xsl:param name="input-invocation-response-data-csv-field-separator"
|
|
select="''"
|
|
as="xs:string" />
|
|
<xsl:param name="input-invocation-response-data-csv-line-separator"
|
|
select="''" as="xs:string" />
|
|
<xsl:param name="output-invocation-response-data-type"
|
|
select="'xml'" as="xs:string" /><!--
|
|
csv, json or xml -->
|
|
<xsl:param name="output-invocation-response-data-csv-field-separator"
|
|
select="''"
|
|
as="xs:string" />
|
|
<xsl:param name="output-invocation-response-data-csv-line-separator"
|
|
select="''"
|
|
as="xs:string" />
|
|
|
|
|
|
<!-- [Common] -->
|
|
<xsl:param name="input-csv-field-separator" select="';'"
|
|
as="xs:string" />
|
|
<xsl:param name="input-csv-line-separator" select="'\r\n?|\n\r?'"
|
|
as="xs:string" />
|
|
<xsl:param name="output-csv-field-separator" select="','"
|
|
as="xs:string" />
|
|
<xsl:param name="output-csv-line-separator" select="'
'"
|
|
as="xs:string" />
|
|
<xsl:param name="input-csv-quote" select="'"'" as="xs:string" />
|
|
<xsl:param name="output-csv-quote" select="'"'" as="xs:string" />
|
|
|
|
<!-- [MF] use-csv false -->
|
|
<xsl:use-package name="csv-xsl-package"
|
|
package-version="*">
|
|
<xsl:override>
|
|
<!-- Change the field separator here to use semicolon, comma, etc between -->
|
|
<!-- fields -->
|
|
<xsl:variable name="csv:field-separator" as="xs:string"
|
|
select="$input-csv-field-separator" visibility="public" />
|
|
<xsl:variable name="csv:line-separator" as="xs:string"
|
|
select="$input-csv-line-separator" visibility="public" />
|
|
<xsl:variable name="csv:quote" as="xs:string" select="$input-csv-quote"
|
|
visibility="public" />
|
|
</xsl:override>
|
|
</xsl:use-package>
|
|
|
|
<!-- [Template match="/" ] [Start] -->
|
|
<xsl:template match="/" priority="9">
|
|
<xsl:variable name="finalResultVar">
|
|
<xsl:call-template name="injectData">
|
|
<xsl:with-param name="headerVar"
|
|
select="fwkmapping:fwkMappingIn/fwkmapping:fwkMapping/fwkmapping:header" />
|
|
<xsl:with-param name="mappingDataVar"
|
|
select="fwkmapping:fwkMappingIn/fwkmapping:fwkMapping/fwkmapping:mappingData" />
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
|
|
<!-- ADD Update Global Status -->
|
|
<xsl:variable name="updatedStatusVar">
|
|
<xsl:call-template name="updateStatus">
|
|
<xsl:with-param name="finalResultHeaderVar"
|
|
select="$finalResultVar/fwkmapping:fwkMappingOut/fwkmapping:fwkMapping/fwkmapping:header" />
|
|
<xsl:with-param name="finalResultMappingDataVar"
|
|
select="$finalResultVar/fwkmapping:fwkMappingOut/fwkmapping:fwkMapping/fwkmapping:mappingData" />
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
|
|
<!-- Write Files -->
|
|
<xsl:call-template name="writeFiles">
|
|
<xsl:with-param name="finalUpdatedResult" select="$updatedStatusVar" />
|
|
</xsl:call-template>
|
|
</xsl:template>
|
|
<!-- [Template match="/" ] [End] -->
|
|
|
|
<!-- [Inject data] [Start] -->
|
|
<xsl:template name="injectData">
|
|
<xsl:param name="headerVar" />
|
|
<xsl:param name="mappingDataVar" />
|
|
<fwkmapping:fwkMappingOut>
|
|
<fwkmapping:fwkMapping>
|
|
<xsl:copy-of copy-namespaces="no" select="$headerVar" />
|
|
<xsl:for-each select="$mappingDataVar">
|
|
<!-- <xsl:try> -->
|
|
<!-- [File handling] [Start] -->
|
|
<!-- ###[Transient Data]### -->
|
|
<xsl:variable name="transient-data">
|
|
<xsl:choose>
|
|
<xsl:when
|
|
test="string-length(fwkmapping:transient/document:filename)>0 and string-length(fwkmapping:transient/document:content/document:text)=0">
|
|
<xsl:copy-of
|
|
select="unparsed-text(concat('file:///',fwkmapping:transient/document:filename))" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of
|
|
select="fwkmapping:transient/document:content/document:text" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:variable>
|
|
<!-- ###[Invocation Response]### -->
|
|
<xsl:variable name="InvocationResponse-data">
|
|
<xsl:choose>
|
|
<xsl:when
|
|
test="string-length(fwkmapping:invocation/invocationContext:response/document:filename)>0 and string-length(fwkmapping:invocation/invocationContext:response/document:content/document:text)=0">
|
|
<xsl:copy-of
|
|
select="unparsed-text(concat('file:///',fwkmapping:invocation/invocationContext:response/document:filename))" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of
|
|
select="fwkmapping:invocation/invocationContext:response/document:content/document:text" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:variable>
|
|
<!-- ###[Payload Data]### -->
|
|
<xsl:variable name="payload-data">
|
|
<xsl:choose>
|
|
<xsl:when
|
|
test="string-length(fwkmapping:document/document:filename)>0 and string-length(fwkmapping:document/document:content/document:text)=0">
|
|
<xsl:copy-of
|
|
select="unparsed-text(concat('file:///',fwkmapping:document/document:filename))" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of
|
|
select="fwkmapping:document/document:content/document:text" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:variable>
|
|
<!-- [File handling] [End] -->
|
|
|
|
|
|
<!-- Parse transient input -->
|
|
<xsl:variable name="transient">
|
|
<xsl:if test="string-length($transient-data)>0">
|
|
<xsl:choose>
|
|
<!-- [MF] use-csv false -->
|
|
<xsl:when test="$input-transient-data-type='csv'">
|
|
<xsl:copy-of
|
|
select="csv:parse($transient-data,$input-transient-data-csv-line-separator,$input-transient-data-csv-field-separator)" />
|
|
</xsl:when>
|
|
<xsl:when test="$input-transient-data-type='json'">
|
|
<xsl:copy-of select="fn:json-to-xml($transient-data)" />
|
|
</xsl:when>
|
|
<xsl:when test="$input-transient-data-type='xml'">
|
|
<xsl:copy-of select="parse-xml($transient-data)" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of select="$transient-data" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:if>
|
|
</xsl:variable>
|
|
<!-- Parse Invocation Request -->
|
|
<xsl:variable name="invocation-Request">
|
|
<xsl:if
|
|
test="string-length(fwkmapping:invocation/invocationContext:request/document:content/document:text)>0">
|
|
<xsl:choose>
|
|
<!-- [MF] use-csv false -->
|
|
<xsl:when test="$input-invocation-request-data-type='csv'">
|
|
<xsl:copy-of
|
|
select="csv:parse(fwkmapping:invocation/invocationContext:request/document:content/document:text,$input-invocation-request-data-csv-line-separator,$input-invocation-request-data-csv-field-separator)" />
|
|
</xsl:when>
|
|
<xsl:when test="$input-invocation-request-data-type='json'">
|
|
<xsl:copy-of
|
|
select="fn:json-to-xml(fwkmapping:invocation/invocationContext:request/document:content/document:text)" />
|
|
</xsl:when>
|
|
<xsl:when test="$input-invocation-request-data-type='xml'">
|
|
<xsl:copy-of
|
|
select="parse-xml(fwkmapping:invocation/invocationContext:request/document:content/document:text)" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of
|
|
select="fwkmapping:invocation/invocationContext:request/document:content/document:text" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:if>
|
|
</xsl:variable>
|
|
<!-- Parse Invocation Response -->
|
|
<xsl:variable name="invocation-Response">
|
|
<xsl:if test="string-length($InvocationResponse-data)>0">
|
|
<xsl:choose>
|
|
<!-- [MF] use-csv false -->
|
|
<xsl:when test="$input-invocation-response-data-type='csv'">
|
|
<xsl:copy-of
|
|
select="csv:parse($InvocationResponse-data,$input-invocation-response-data-csv-line-separator,$input-invocation-response-data-csv-field-separator)" />
|
|
</xsl:when>
|
|
<xsl:when test="$input-invocation-response-data-type='json'">
|
|
<xsl:copy-of select="fn:json-to-xml($InvocationResponse-data)" />
|
|
</xsl:when>
|
|
<xsl:when test="$input-invocation-response-data-type='xml'">
|
|
<xsl:copy-of select="parse-xml($InvocationResponse-data)" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of select="$InvocationResponse-data" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:if>
|
|
</xsl:variable>
|
|
<!-- Parse Document input -->
|
|
<xsl:variable name="data">
|
|
<xsl:if test="string-length($payload-data)>0">
|
|
<xsl:choose>
|
|
<!-- [MF] use-csv false -->
|
|
<xsl:when test="$input-data-type='csv'">
|
|
<xsl:copy-of
|
|
select="csv:parse($payload-data,$input-data-csv-line-separator,$input-data-csv-field-separator)" />
|
|
</xsl:when>
|
|
<xsl:when test="$input-data-type='json'">
|
|
<xsl:copy-of select="fn:json-to-xml($payload-data)" />
|
|
</xsl:when>
|
|
<xsl:when test="$input-data-type='xml'">
|
|
<xsl:copy-of select="parse-xml($payload-data)" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of select="$payload-data" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:if>
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
<!-- [call-template name="mapWrapper"] -->
|
|
<xsl:variable name="resultVar">
|
|
<xsl:call-template name="mapWrapper">
|
|
<xsl:with-param name="wrapperHeaderVar" select="$headerVar" />
|
|
<!-- Add New -->
|
|
<xsl:with-param name="wrapperobjectTypeVar"
|
|
select="$mappingDataVar/fwkmapping:objectType" />
|
|
<xsl:with-param name="wrapperfileNameVar"
|
|
select="$mappingDataVar/fwkmapping:fileName" />
|
|
<xsl:with-param name="wrapperFunctionalKeysVar"
|
|
select="$mappingDataVar/fwkmapping:functionalKeys" />
|
|
<!-- Add New -->
|
|
<xsl:with-param name="wrapperParametersVar"
|
|
select="$mappingDataVar/fwkmapping:parameters" />
|
|
<xsl:with-param name="wrapperTransientVar" select="$transient" />
|
|
<xsl:with-param name="wrapperTransientFileVar"
|
|
select="fwkmapping:transient/document:filename" />
|
|
<xsl:with-param name="wrapperInvocationReqVar"
|
|
select="$invocation-Request" />
|
|
<xsl:with-param name="wrapperInvocationRespVar"
|
|
select="$invocation-Response" />
|
|
<xsl:with-param name="wrapperInvocationRespFileVar"
|
|
select="fwkmapping:invocation/invocationContext:response/document:filename" />
|
|
<xsl:with-param name="wrapperDataVar" select="$data" />
|
|
<xsl:with-param name="wrapperDataFileVar"
|
|
select="fwkmapping:document/document:filename" />
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="finalResultVar">
|
|
<!-- Invokes business map -->
|
|
<xsl:apply-templates select="$resultVar" mode="tibco" />
|
|
</xsl:variable>
|
|
|
|
<xsl:for-each
|
|
select="$finalResultVar/fwkmapping:fwkMappingOut/fwkmapping:fwkMapping/fwkmapping:mappingData">
|
|
<fwkmapping:mappingData>
|
|
<fwkmapping:status>
|
|
<xsl:value-of select="'OK'" />
|
|
</fwkmapping:status>
|
|
|
|
<!-- Add New -->
|
|
<fwkmapping:objectType>
|
|
<xsl:value-of select="fwkmapping:objectType" />
|
|
</fwkmapping:objectType>
|
|
<fwkmapping:fileName>
|
|
<xsl:value-of select="fwkmapping:fileName" />
|
|
</fwkmapping:fileName>
|
|
|
|
|
|
<!-- [FunctionalKeys](Start] -->
|
|
<fwkmapping:functionalKeys>
|
|
<xsl:for-each
|
|
select="fwkmapping:functionalKeys/fwkmapping:functionalKey">
|
|
<fwkmapping:functionalKey>
|
|
<property:name>
|
|
<xsl:value-of select="property:name" />
|
|
</property:name>
|
|
<property:value>
|
|
<xsl:value-of select="property:value" />
|
|
</property:value>
|
|
</fwkmapping:functionalKey>
|
|
</xsl:for-each>
|
|
</fwkmapping:functionalKeys>
|
|
|
|
<!-- [FunctionalKeys](End] -->
|
|
|
|
|
|
<!-- Add New -->
|
|
|
|
<!-- [Parameters](Start] -->
|
|
<fwkmapping:parameters>
|
|
<xsl:for-each select="fwkmapping:parameters/fwkmapping:parameter">
|
|
<fwkmapping:parameter>
|
|
<property:name>
|
|
<xsl:value-of select="property:name" />
|
|
</property:name>
|
|
<property:value>
|
|
<xsl:value-of select="property:value" />
|
|
</property:value>
|
|
</fwkmapping:parameter>
|
|
</xsl:for-each>
|
|
</fwkmapping:parameters>
|
|
|
|
<!-- [Parameters](End] -->
|
|
|
|
<!-- [Transient][Start] -->
|
|
<xsl:if test="fwkmapping:transient">
|
|
<fwkmapping:transient>
|
|
<document:content>
|
|
<xsl:choose>
|
|
<xsl:when test="$output-transient-data-type='csv'">
|
|
<document:text>
|
|
<xsl:apply-templates
|
|
select="fwkmapping:transient/document:content/document:xml/*"
|
|
mode="csv-render-new">
|
|
<xsl:with-param name="output-csv-line-separator"
|
|
select="output-transient-data-csv-line-separator" />
|
|
<xsl:with-param name="output-csv-field-separator"
|
|
select="output-transient-data-csv-field-separator" />
|
|
</xsl:apply-templates>
|
|
</document:text>
|
|
</xsl:when>
|
|
<xsl:when test="$output-transient-data-type='json'">
|
|
<document:text>
|
|
<xsl:value-of
|
|
select="fn:xml-to-json(fwkmapping:transient/document:content/document:xml/*, map{'number-formatter': function($x){$x}}) => parse-json() => serialize(map{ 'method' : 'json', 'use-character-maps' : map { '/' : '/' } })" />
|
|
</document:text>
|
|
</xsl:when>
|
|
<xsl:when test="$output-transient-data-type='xml'">
|
|
<document:text>
|
|
<!-- Remove Extra namespaces -->
|
|
<xsl:variable name="xml_var">
|
|
<xsl:copy-of
|
|
select="fwkmapping:transient/document:content/document:xml/*"
|
|
copy-namespaces="no" />
|
|
</xsl:variable>
|
|
<xsl:copy-of select="serialize($xml_var)"
|
|
copy-namespaces="no" />
|
|
<!-- Remove Extra namespaces -->
|
|
</document:text>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<document:text>
|
|
<xsl:value-of
|
|
select="fwkmapping:transient/document:content/document:text" />
|
|
</document:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</document:content>
|
|
<document:filename>
|
|
<xsl:value-of select="fwkmapping:transient/document:filename" />
|
|
</document:filename>
|
|
<document:size>
|
|
<xsl:value-of select="fwkmapping:transient/document:size" />
|
|
</document:size>
|
|
</fwkmapping:transient>
|
|
</xsl:if>
|
|
<!-- [Transient][End] -->
|
|
|
|
<!-- [Invocation][Start] -->
|
|
<xsl:if test="fwkmapping:invocation">
|
|
<fwkmapping:invocation>
|
|
<xsl:if test="fwkmapping:invocation/invocationContext:request">
|
|
<invocationContext:request>
|
|
<document:content>
|
|
<xsl:choose>
|
|
<xsl:when test="$output-invocation-request-data-type='csv'">
|
|
<document:text>
|
|
<xsl:apply-templates
|
|
select="fwkmapping:invocation/invocationContext:request/document:content/document:xml/*"
|
|
mode="csv-render-new">
|
|
<xsl:with-param name="output-csv-line-separator"
|
|
select="output-invocation-request-data-csv-line-separator" />
|
|
<xsl:with-param name="output-csv-field-separator"
|
|
select="output-invocation-request-data-csv-field-separator" />
|
|
</xsl:apply-templates>
|
|
</document:text>
|
|
</xsl:when>
|
|
<xsl:when test="$output-invocation-request-data-type='json'">
|
|
<document:text>
|
|
<xsl:value-of
|
|
select="fn:xml-to-json(fwkmapping:invocation/invocationContext:request/document:content/document:xml/*, map{'number-formatter': function($x){$x}}) => parse-json() => serialize(map{ 'method' : 'json', 'use-character-maps' : map { '/' : '/' } })" />
|
|
</document:text>
|
|
</xsl:when>
|
|
<xsl:when test="$output-invocation-request-data-type='xml'">
|
|
<document:text>
|
|
<!-- Remove Extra namespaces -->
|
|
<xsl:variable name="xml_var">
|
|
<xsl:copy-of
|
|
select="fwkmapping:invocation/invocationContext:request/document:content/document:xml/*"
|
|
copy-namespaces="no" />
|
|
</xsl:variable>
|
|
<xsl:copy-of select="serialize($xml_var)"
|
|
copy-namespaces="no" />
|
|
<!-- Remove Extra namespaces -->
|
|
</document:text>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<document:text>
|
|
<xsl:value-of
|
|
select="fwkmapping:invocation/invocationContext:request/document:content/document:text" />
|
|
</document:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</document:content>
|
|
<document:filename>
|
|
<xsl:value-of
|
|
select="fwkmapping:invocation/invocationContext:request/document:filename" />
|
|
</document:filename>
|
|
<document:size>
|
|
<xsl:value-of
|
|
select="fwkmapping:invocation/invocationContext:request/document:size" />
|
|
</document:size>
|
|
</invocationContext:request>
|
|
</xsl:if>
|
|
<xsl:if test="fwkmapping:invocation/invocationContext:response">
|
|
<invocationContext:response>
|
|
<document:content>
|
|
<xsl:choose>
|
|
<xsl:when test="$output-invocation-response-data-type='csv'">
|
|
<document:text>
|
|
<xsl:apply-templates
|
|
select="fwkmapping:invocation/invocationContext:response/document:content/document:xml/*"
|
|
mode="csv-render-new">
|
|
<xsl:with-param name="output-csv-line-separator"
|
|
select="output-invocation-response-data-csv-line-separator" />
|
|
<xsl:with-param name="output-csv-field-separator"
|
|
select="output-invocation-response-data-csv-field-separator" />
|
|
</xsl:apply-templates>
|
|
</document:text>
|
|
</xsl:when>
|
|
<xsl:when test="$output-invocation-response-data-type='json'">
|
|
<document:text>
|
|
<xsl:value-of
|
|
select="fn:xml-to-json(fwkmapping:invocation/invocationContext:response/document:content/document:xml/*, map{'number-formatter': function($x){$x}}) => parse-json() => serialize(map{ 'method' : 'json', 'use-character-maps' : map { '/' : '/' } })" />
|
|
</document:text>
|
|
</xsl:when>
|
|
<xsl:when test="$output-invocation-response-data-type='xml'">
|
|
<document:text>
|
|
<!-- Remove Extra namespaces -->
|
|
<xsl:variable name="xml_var">
|
|
<xsl:copy-of
|
|
select="fwkmapping:invocation/invocationContext:response/document:content/document:xml/*"
|
|
copy-namespaces="no" />
|
|
</xsl:variable>
|
|
<xsl:copy-of select="serialize($xml_var)"
|
|
copy-namespaces="no" />
|
|
<!-- Remove Extra namespaces -->
|
|
</document:text>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<document:text>
|
|
<xsl:value-of
|
|
select="fwkmapping:invocation/invocationContext:response/document:content/document:text" />
|
|
</document:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</document:content>
|
|
<document:filename>
|
|
<xsl:value-of
|
|
select="fwkmapping:invocation/invocationContext:response/document:filename" />
|
|
</document:filename>
|
|
<document:size>
|
|
<xsl:value-of
|
|
select="fwkmapping:invocation/invocationContext:response/document:size" />
|
|
</document:size>
|
|
</invocationContext:response>
|
|
</xsl:if>
|
|
</fwkmapping:invocation>
|
|
</xsl:if>
|
|
<!-- [Invocation][End] -->
|
|
|
|
<!-- Build output -->
|
|
<xsl:variable name="output-content">
|
|
<xsl:choose>
|
|
<xsl:when test="$output-data-type='csv'">
|
|
<xsl:apply-templates
|
|
select="fwkmapping:document/document:content/document:xml/*"
|
|
mode="csv-render-new">
|
|
<xsl:with-param name="output-csv-line-separator"
|
|
select="$output-data-csv-line-separator" />
|
|
<xsl:with-param name="output-csv-field-separator"
|
|
select="$output-data-csv-field-separator" />
|
|
</xsl:apply-templates>
|
|
</xsl:when>
|
|
<xsl:when test="$output-data-type='json'">
|
|
<xsl:value-of
|
|
select="fn:xml-to-json(fwkmapping:document/document:content/document:xml/*, map{'number-formatter': function($x){$x}}) => parse-json() => serialize(map{ 'method' : 'json', 'use-character-maps' : map { '/' : '/' } })" />
|
|
</xsl:when>
|
|
<xsl:when test="$output-data-type='xml'">
|
|
<!-- Remove Extra namespaces -->
|
|
<xsl:variable name="xml_var">
|
|
<xsl:copy-of
|
|
select="fwkmapping:document/document:content/document:xml/*"
|
|
copy-namespaces="no" />
|
|
</xsl:variable>
|
|
<xsl:copy-of select="serialize($xml_var)"
|
|
copy-namespaces="no" />
|
|
<!-- Remove Extra namespaces -->
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of
|
|
select="fwkmapping:document/document:content/document:text" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:variable>
|
|
|
|
<!-- [Document][Start] -->
|
|
<fwkmapping:document>
|
|
<document:content>
|
|
<document:text>
|
|
<xsl:value-of select="$output-content" />
|
|
</document:text>
|
|
</document:content>
|
|
<document:filename>
|
|
<xsl:value-of select="fwkmapping:document/document:filename" />
|
|
</document:filename>
|
|
<document:size>
|
|
<xsl:value-of select="xs:int(string-length($output-content))" />
|
|
</document:size>
|
|
</fwkmapping:document>
|
|
<!-- [Document][End] -->
|
|
</fwkmapping:mappingData>
|
|
</xsl:for-each>
|
|
<!-- <xsl:catch> -->
|
|
<!-- <fwkmapping:mappingData> -->
|
|
<!-- <fwkmapping:status> -->
|
|
<!-- <xsl:value-of select="'KO'" /> -->
|
|
<!-- </fwkmapping:status> -->
|
|
<!-- <fwkmapping:error> -->
|
|
<!-- <fwkmapping:code> -->
|
|
<!-- <xsl:value-of select="$err:code" /> -->
|
|
<!-- </fwkmapping:code> -->
|
|
<!-- <fwkmapping:level> -->
|
|
<!-- <xsl:value-of select="'ERROR'" /> -->
|
|
<!-- </fwkmapping:level> -->
|
|
<!-- <fwkmapping:message> -->
|
|
<!-- <xsl:value-of select="'Error on parsing content'" /> -->
|
|
<!-- </fwkmapping:message> -->
|
|
<!-- <fwkmapping:cause> -->
|
|
<!-- <xsl:value-of select="$err:description" /> -->
|
|
<!-- </fwkmapping:cause> -->
|
|
<!-- </fwkmapping:error> -->
|
|
<!-- <fwkmapping:document> -->
|
|
<!-- <document:content> -->
|
|
<!-- <document:text> -->
|
|
<!-- <xsl:value-of -->
|
|
<!-- select="fwkmapping:document/document:content/document:text" /> -->
|
|
<!-- </document:text> -->
|
|
<!-- </document:content> -->
|
|
<!-- <document:size> -->
|
|
<!-- <xsl:value-of select="xs:int(fwkmapping:document/document:size)"
|
|
/> -->
|
|
<!-- </document:size> -->
|
|
<!-- </fwkmapping:document> -->
|
|
<!-- </fwkmapping:mappingData> -->
|
|
<!-- </xsl:catch> -->
|
|
<!-- </xsl:try> -->
|
|
</xsl:for-each>
|
|
</fwkmapping:fwkMapping>
|
|
</fwkmapping:fwkMappingOut>
|
|
</xsl:template>
|
|
<!-- [Inject data] [End] -->
|
|
|
|
|
|
<!-- [Update Global Status] [Start] -->
|
|
<xsl:template name="updateStatus">
|
|
<xsl:param name="finalResultHeaderVar" />
|
|
<xsl:param name="finalResultMappingDataVar" />
|
|
<fwkmapping:fwkMappingOut>
|
|
<fwkmapping:fwkMapping>
|
|
<fwkmapping:header>
|
|
<header:mapName>
|
|
<xsl:value-of select="$finalResultHeaderVar/header:mapName" />
|
|
</header:mapName>
|
|
<header:instanceId>
|
|
<xsl:value-of select="$finalResultHeaderVar/header:instanceId" />
|
|
</header:instanceId>
|
|
<header:project>
|
|
<xsl:value-of select="$finalResultHeaderVar/header:project" />
|
|
</header:project>
|
|
<header:exchange>
|
|
<xsl:value-of select="$finalResultHeaderVar/header:exchange" />
|
|
</header:exchange>
|
|
<header:halfFlow>
|
|
<xsl:value-of select="$finalResultHeaderVar/header:halfFlow" />
|
|
</header:halfFlow>
|
|
<header:process>
|
|
<xsl:value-of select="$finalResultHeaderVar/header:process" />
|
|
</header:process>
|
|
<xsl:choose>
|
|
<xsl:when
|
|
test="exists($finalResultMappingDataVar[fwkmapping:status='KO'])">
|
|
<header:status>
|
|
<xsl:value-of select="'KO'" />
|
|
</header:status>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<header:status>
|
|
<xsl:value-of select="'OK'" />
|
|
</header:status>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</fwkmapping:header>
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="$finalResultMappingDataVar" />
|
|
</fwkmapping:fwkMapping>
|
|
</fwkmapping:fwkMappingOut>
|
|
</xsl:template>
|
|
<!-- [Update Global Status] [End] -->
|
|
|
|
<!-- [mapWrapper][Start] -->
|
|
<xsl:template name="mapWrapper">
|
|
<xsl:param name="wrapperHeaderVar" />
|
|
<!-- Add New -->
|
|
<xsl:param name="wrapperobjectTypeVar" />
|
|
<xsl:param name="wrapperfileNameVar" />
|
|
<xsl:param name="wrapperFunctionalKeysVar" />
|
|
<!-- Add New -->
|
|
<xsl:param name="wrapperParametersVar" />
|
|
<xsl:param name="wrapperTransientVar" />
|
|
<xsl:param name="wrapperTransientFileVar" />
|
|
<xsl:param name="wrapperInvocationReqVar" />
|
|
<xsl:param name="wrapperInvocationRespVar" />
|
|
<xsl:param name="wrapperInvocationRespFileVar" />
|
|
<xsl:param name="wrapperDataVar" />
|
|
<xsl:param name="wrapperDataFileVar" />
|
|
<!-- [Add fwkMappingIn] -->
|
|
<fwkmapping:fwkMappingIn>
|
|
<!-- [Add fwkMappingIn] -->
|
|
<fwkmapping:fwkMapping>
|
|
<xsl:copy-of copy-namespaces="no" select="$wrapperHeaderVar" />
|
|
<fwkmapping:mappingData>
|
|
|
|
<!-- Add New -->
|
|
<xsl:copy-of copy-namespaces="no" select="$wrapperobjectTypeVar" />
|
|
<xsl:copy-of copy-namespaces="no" select="$wrapperfileNameVar" />
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="$wrapperFunctionalKeysVar" />
|
|
<!-- Add New -->
|
|
|
|
<xsl:copy-of copy-namespaces="no" select="$wrapperParametersVar" />
|
|
<!-- Transient -->
|
|
<fwkmapping:transient>
|
|
<document:content>
|
|
<document:xml>
|
|
<xsl:copy-of copy-namespaces="no" select="$wrapperTransientVar" />
|
|
</document:xml>
|
|
</document:content>
|
|
<document:filename>
|
|
<xsl:value-of select="$wrapperTransientFileVar" />
|
|
</document:filename>
|
|
<document:size>
|
|
<xsl:value-of select="xs:int(string-length($wrapperTransientVar))" />
|
|
</document:size>
|
|
</fwkmapping:transient>
|
|
<!-- Invocation -->
|
|
<fwkmapping:invocation>
|
|
<invocationContext:request>
|
|
<document:content>
|
|
<document:xml>
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="$wrapperInvocationReqVar" />
|
|
</document:xml>
|
|
</document:content>
|
|
<document:size>
|
|
<xsl:value-of select="xs:int(string-length($wrapperInvocationReqVar))" />
|
|
</document:size>
|
|
</invocationContext:request>
|
|
|
|
<invocationContext:response>
|
|
<document:content>
|
|
<document:xml>
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="$wrapperInvocationRespVar" />
|
|
</document:xml>
|
|
</document:content>
|
|
<document:filename>
|
|
<xsl:value-of select="$wrapperInvocationRespFileVar" />
|
|
</document:filename>
|
|
<document:size>
|
|
<xsl:value-of select="xs:int(string-length($wrapperInvocationRespVar))" />
|
|
</document:size>
|
|
</invocationContext:response>
|
|
</fwkmapping:invocation>
|
|
|
|
<!-- Document -->
|
|
<fwkmapping:document>
|
|
<document:content>
|
|
<document:xml>
|
|
<xsl:copy-of copy-namespaces="no" select="$wrapperDataVar" />
|
|
</document:xml>
|
|
</document:content>
|
|
<document:filename>
|
|
<xsl:value-of select="$wrapperDataFileVar" />
|
|
</document:filename>
|
|
<document:size>
|
|
<xsl:value-of select="xs:int(string-length($wrapperDataVar))" />
|
|
</document:size>
|
|
</fwkmapping:document>
|
|
</fwkmapping:mappingData>
|
|
</fwkmapping:fwkMapping>
|
|
<!-- [Add fwkMappingIn] -->
|
|
<fwkmapping:output-data-type>
|
|
<xsl:value-of select="$output-data-type" />
|
|
</fwkmapping:output-data-type>
|
|
</fwkmapping:fwkMappingIn>
|
|
<!-- [Add fwkMappingIn] -->
|
|
</xsl:template>
|
|
<!-- [mapWrapper][End] -->
|
|
|
|
<!-- [CSV Render][Start] -->
|
|
<!-- [csv-render] -->
|
|
<xsl:template match="csv" mode="csv-render">
|
|
<xsl:param name="output-csv-line-separator" />
|
|
<xsl:param name="output-csv-field-separator" />
|
|
<xsl:for-each select="row">
|
|
<xsl:for-each select="field">
|
|
<xsl:choose>
|
|
<xsl:when test="position() = last()">
|
|
<xsl:value-of
|
|
select="if(@quoted = 'yes') then concat($output-csv-quote, . , $output-csv-quote) else ." />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of
|
|
select="concat(if(@quoted = 'yes') then concat($output-csv-quote, . , $output-csv-quote) else ., $output-csv-field-separator)" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:for-each>
|
|
<!--more efficient, but cannot use variable as separator and cannot customize
|
|
rendering -->
|
|
<!--<xsl:value-of select="field" separator=";" /> -->
|
|
<xsl:value-of select="$output-csv-line-separator" />
|
|
</xsl:for-each>
|
|
</xsl:template>
|
|
|
|
<!-- [csv-render-new] -->
|
|
<xsl:template match="csv" mode="csv-render-new">
|
|
<xsl:param name="output-csv-line-separator" />
|
|
<xsl:param name="output-csv-field-separator" />
|
|
<xsl:for-each select="row">
|
|
<xsl:for-each select="field">
|
|
<xsl:choose>
|
|
<xsl:when test="position() = last()">
|
|
<xsl:value-of
|
|
select="if(@quoted = 'yes') then concat($output-csv-quote, . , $output-csv-quote) else ." />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:value-of
|
|
select="concat(if(@quoted = 'yes') then concat($output-csv-quote, . , $output-csv-quote) else ., $output-csv-field-separator)" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:for-each>
|
|
<!--more efficient, but cannot use variable as separator and cannot customize
|
|
rendering -->
|
|
<!--<xsl:value-of select="field" separator=";" /> -->
|
|
<xsl:value-of select="$output-csv-line-separator" />
|
|
</xsl:for-each>
|
|
</xsl:template>
|
|
<!-- [CSV Render][End] -->
|
|
|
|
<!-- [Write Files] [Start] -->
|
|
<xsl:template name="writeFiles">
|
|
<xsl:param name="finalUpdatedResult" />
|
|
<fwkmapping:fwkMappingOut>
|
|
<fwkmapping:fwkMapping>
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="$finalUpdatedResult/fwkmapping:fwkMappingOut/fwkmapping:fwkMapping/fwkmapping:header" />
|
|
<xsl:for-each
|
|
select="$finalUpdatedResult/fwkmapping:fwkMappingOut/fwkmapping:fwkMapping/fwkmapping:mappingData">
|
|
|
|
<!-- Get base uri [Start] -->
|
|
|
|
<xsl:variable name="transient-base-path">
|
|
<xsl:value-of
|
|
select="substring-before(fwkmapping:transient/document:filename,concat('/',fn:tokenize(fwkmapping:transient/document:filename,'/')[last()]))" />
|
|
</xsl:variable>
|
|
<xsl:variable name="invocation-base-path">
|
|
<xsl:value-of
|
|
select="substring-before(fwkmapping:invocation/invocationContext:response/document:filename,concat('/',fn:tokenize(fwkmapping:invocation/invocationContext:response/document:filename,'/')[last()]))" />
|
|
</xsl:variable>
|
|
<xsl:variable name="document-base-path">
|
|
<xsl:value-of
|
|
select="substring-before(fwkmapping:document/document:filename,concat('/',fn:tokenize(fwkmapping:document/document:filename,'/')[last()]))" />
|
|
</xsl:variable>
|
|
|
|
<!-- Get base url [End] -->
|
|
|
|
<fwkmapping:mappingData>
|
|
<fwkmapping:status>
|
|
<xsl:value-of select="'OK'" />
|
|
</fwkmapping:status>
|
|
|
|
<!-- Add New -->
|
|
<xsl:copy-of copy-namespaces="no" select="fwkmapping:objectType" />
|
|
<xsl:copy-of copy-namespaces="no" select="fwkmapping:fileName" />
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="fwkmapping:functionalKeys" />
|
|
<!-- Add New -->
|
|
|
|
<xsl:copy-of copy-namespaces="no" select="fwkmapping:parameters" />
|
|
|
|
<!-- [Transient] [Start] -->
|
|
<xsl:if test="fwkmapping:transient">
|
|
<xsl:choose>
|
|
<xsl:when
|
|
test="string-length(fwkmapping:transient/document:filename)>0">
|
|
<fwkmapping:transient>
|
|
<!-- [ Data File handling ] [Start] -->
|
|
<xsl:variable name="dataFilePath">
|
|
<xsl:value-of
|
|
select="concat($transient-base-path,'/',$finalUpdatedResult/fwkmapping:fwkMappingOut/fwkmapping:fwkMapping/fwkmapping:header/header:instanceId,'_',fn:generate-id(.),fn:seconds-from-dateTime(fn:current-dateTime()),'_transient_out')" />
|
|
</xsl:variable>
|
|
|
|
<xsl:result-document href="{concat('file:///',$dataFilePath)}"
|
|
method="text">
|
|
<xsl:value-of
|
|
select="fwkmapping:transient/document:content/document:text" />
|
|
</xsl:result-document>
|
|
|
|
<document:filename>
|
|
<xsl:value-of select="$dataFilePath" />
|
|
</document:filename>
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="fwkmapping:transient/document:size" />
|
|
<!-- [ Data File handling ] [End] -->
|
|
</fwkmapping:transient>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of copy-namespaces="no" select="fwkmapping:transient" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:if>
|
|
<!-- [Transient] [End] -->
|
|
|
|
<!-- [Invocation][Start] -->
|
|
<xsl:if test="fwkmapping:invocation">
|
|
<fwkmapping:invocation>
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="fwkmapping:invocation/invocationContext:request" />
|
|
|
|
<xsl:choose>
|
|
<xsl:when
|
|
test="string-length(fwkmapping:invocation/invocationContext:response/document:filename)>0">
|
|
<invocationContext:response>
|
|
<!-- [ Data File handling ] [Start] -->
|
|
<xsl:variable name="dataFilePath">
|
|
<xsl:value-of
|
|
select="concat($invocation-base-path,'/',$finalUpdatedResult/fwkmapping:fwkMappingOut/fwkmapping:fwkMapping/fwkmapping:header/header:instanceId,'_',fn:generate-id(.),fn:seconds-from-dateTime(fn:current-dateTime()),'_InvocationResponse_out')" />
|
|
</xsl:variable>
|
|
|
|
<xsl:result-document href="{concat('file:///',$dataFilePath)}"
|
|
method="text">
|
|
<xsl:value-of
|
|
select="fwkmapping:invocation/invocationContext:response/document:content/document:text" />
|
|
</xsl:result-document>
|
|
|
|
<document:filename>
|
|
<xsl:value-of select="$dataFilePath" />
|
|
</document:filename>
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="fwkmapping:invocation/invocationContext:response/document:size" />
|
|
<!-- [ Data File handling ] [End] -->
|
|
</invocationContext:response>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="fwkmapping:invocation/invocationContext:response" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
|
|
</fwkmapping:invocation>
|
|
</xsl:if>
|
|
<!-- [Invocation][End] -->
|
|
|
|
<!-- [Document] [Start] -->
|
|
<xsl:choose>
|
|
<xsl:when
|
|
test="string-length(fwkmapping:document/document:filename)>0">
|
|
<fwkmapping:document>
|
|
<!-- [ Data File handling ] [Start] -->
|
|
<xsl:variable name="dataFilePath">
|
|
<xsl:value-of
|
|
select="concat($document-base-path,'/',$finalUpdatedResult/fwkmapping:fwkMappingOut/fwkmapping:fwkMapping/fwkmapping:header/header:instanceId,'_',fn:generate-id(.),fn:seconds-from-dateTime(fn:current-dateTime()),'_content_out')" />
|
|
</xsl:variable>
|
|
|
|
<xsl:result-document href="{concat('file:///',$dataFilePath)}"
|
|
method="text">
|
|
<xsl:value-of
|
|
select="fwkmapping:document/document:content/document:text" />
|
|
</xsl:result-document>
|
|
|
|
<document:filename>
|
|
<xsl:value-of select="$dataFilePath" />
|
|
</document:filename>
|
|
<xsl:copy-of copy-namespaces="no"
|
|
select="fwkmapping:document/document:size" />
|
|
<!-- [ Data File handling ] [End] -->
|
|
</fwkmapping:document>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of copy-namespaces="no" select="fwkmapping:document" />
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
<!-- [Document] [End] -->
|
|
</fwkmapping:mappingData>
|
|
</xsl:for-each>
|
|
</fwkmapping:fwkMapping>
|
|
</fwkmapping:fwkMappingOut>
|
|
</xsl:template>
|
|
<!-- [Write Files] [End] -->
|
|
|
|
<!--[TIBCO_TEMPLATE] -->
|
|
|
|
<xsl:template name="Mapper-input" match="/" mode="tibco" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tns="http://www.loreal.com/hip/fwk/mapping/FwkMapping" xmlns:ns="http://www.loreal.com/hip/fwk/mapping/Document" xmlns:tns2="http://www.example.org/MappingWrapper" xmlns:ns4="http://www.loreal.com/hip/fwk/common/Property" xmlns:ns1="http://www.w3.org/2005/xpath-functions" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
|
|
<!-- TIBCO parameters are converted to variables -->
|
|
<xsl:variable name="Start" select="tns:fwkMappingIn" />
|
|
<xsl:variable name="ParseCSV" select="$Start/tns:fwkMapping/tns:mappingData/tns:document/ns:content/ns:xml/*" />
|
|
<xsl:variable name="ParseXML" select="$Start/tns:fwkMapping/tns:mappingData/tns:document/ns:content/ns:xml/*" />
|
|
<xsl:variable name="ParseJSON" select="$Start/tns:fwkMapping/tns:mappingData/tns:document/ns:content/ns:xml/*" />
|
|
<!-- TIBCO map -->
|
|
<tns:fwkMappingOut>
|
|
<tns:fwkMapping>
|
|
<xsl:copy-of select="$Start/tns:fwkMapping/tns:header"/>
|
|
<tns:mappingData>
|
|
<!--/!\ The functional keys must be mapped /!\-->
|
|
<!--/!\ The parameters must be mapped /!\-->
|
|
<tns:functionalKeys>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""selectedlocation""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="$Start/tns:fwkMapping/tns:mappingData[1]/tns:functionalKeys/tns:functionalKey[ns4:name="selectedlocation"]/ns4:value"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""selectedorganization""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="$Start/tns:fwkMapping/tns:mappingData[1]/tns:functionalKeys/tns:functionalKey[ns4:name="selectedorganization"]/ns4:value"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""msg_submission_time""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="$Start/tns:fwkMapping/tns:mappingData[1]/tns:functionalKeys/tns:functionalKey[ns4:name="msg_submission_time"]/ns4:value"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Sonar_Action""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select=""CREATE""/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Sonar_Source""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select=""MANHATTAN""/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Sonar_OverallStatus""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select=""RECEIVED_HIP""/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Sonar_Application""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select=""SAP""/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Sonar_BusinessObject""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="$Start/tns:fwkMapping/tns:mappingData[1]/tns:functionalKeys/tns:functionalKey[ns4:name="message_type"]/ns4:value"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Sonar_Domain""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select=""SUPPLY CHAIN""/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""ShipConfirmBatchId""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="$ParseJSON/ns1:map[@key="Message"]/ns1:map[@key="ShipConfirm"]/ns1:map[@key="ShipConfirmSummary"]/ns1:map[@key="ShipConfirmHeaderInfo"]/ns1:string[@key="ShipConfirmBatchId"]"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Publication_MessageId""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="$Start/tns:fwkMapping/tns:mappingData[1]/tns:functionalKeys/tns:functionalKey[ns4:name="msg_id_pk"]/ns4:value"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Sonar_ObjectID""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="$ParseJSON/ns1:map[@key="Message"]/ns1:map[@key="ShipConfirm"]/ns1:map[@key="ShipConfirmSummary"]/ns1:map[@key="ShipConfirmHeaderInfo"]/ns1:string[@key="ShipConfirmBatchId"]"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Sonar_TrackingID""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="$ParseJSON/ns1:map[@key="Message"]/ns1:map[@key="ShipConfirm"]/ns1:map[@key="ShipConfirmSummary"]/ns1:map[@key="ShipConfirmHeaderInfo"]/ns1:string[@key="ShipConfirmBatchId"]"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""Warehouse""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="$Start/tns:fwkMapping/tns:mappingData[1]/tns:functionalKeys/tns:functionalKey[ns4:name="selectedlocation"]/ns4:value"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""NumberOfOrder""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="xsd:string(count($ParseJSON/ns1:map[@key="Message"]/ns1:map[@key="ShipConfirm"]/ns1:map[@key="ShipConfirmDetails"]/ns1:array[@key="Order"]/ns1:map))"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
<tns:functionalKey>
|
|
<ns4:name>
|
|
<xsl:value-of select=""NumberOfOriginalOrder""/>
|
|
</ns4:name>
|
|
<ns4:value>
|
|
<xsl:value-of select="xsd:string(count($ParseJSON/ns1:map[@key="Message"]/ns1:map[@key="ShipConfirm"]/ns1:map[@key="ShipConfirmDetails"]/ns1:array[@key="OriginalOrder"]/ns1:map))"/>
|
|
</ns4:value>
|
|
</tns:functionalKey>
|
|
</tns:functionalKeys>
|
|
<xsl:copy-of select="$Start/tns:fwkMapping/tns:mappingData[1]/tns:parameters"/>
|
|
<xsl:copy-of select="$Start/tns:fwkMapping/tns:mappingData/tns:transient"/>
|
|
<xsl:copy-of select="$Start/tns:fwkMapping/tns:mappingData/tns:invocation"/>
|
|
<tns:document>
|
|
<ns:content>
|
|
<ns:xml>
|
|
<!--Add a type substitution for your schema.-->
|
|
<!--Depending on your data input (csv, json or xml), pick from the right activity-->
|
|
<xsl:choose>
|
|
<xsl:when test="$Start/tns:output-data-type = 'csv'">
|
|
<xsl:copy-of select="$ParseCSV"/>
|
|
</xsl:when>
|
|
<xsl:when test="$Start/tns:output-data-type = 'json'">
|
|
<xsl:copy-of select="$ParseJSON"/>
|
|
</xsl:when>
|
|
<xsl:when test="$Start/tns:output-data-type = 'xml'">
|
|
<xsl:copy-of select="$ParseXML"/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:copy-of select="$Start/tns:fwkMapping/tns:mappingData/tns:document/ns:content/ns:xml/*"/>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</ns:xml>
|
|
</ns:content>
|
|
<ns:size>
|
|
<xsl:value-of select="0"/>
|
|
</ns:size>
|
|
</tns:document>
|
|
</tns:mappingData>
|
|
</tns:fwkMapping>
|
|
</tns:fwkMappingOut>
|
|
</xsl:template>
|
|
|
|
|
|
</xsl:stylesheet>
|