XSLT Mapping with DynamicConfiguration

…without using SAP XML Toolkit:  SAP Note 1731772

  1. All access to complex objects used as parameters or an object on which methods are called should be casted to the proper type using the XSLTC cast function (xsltc:cast). The xsltc namespace must be present in the namespaces used: xmlns:xsltc=”http://xml.apache.org/xalan/xsltc”
  2. All namespaces pointing to java classes should be defined without java: prefix to be compatible with the JDK toolkit.

Example XSLT mapping:

<?xml version=”1.0″ encoding=”UTF-8″ ?>
<xsl:stylesheet version=”1.0″
xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”
xmlns:xsltc=”http://xml.apache.org/xalan/xsltc”
xmlns:map=”java.util.Map”
xmlns:dyn=”com.sap.aii.mapping.api.DynamicConfiguration”
xmlns:key=”com.sap.aii.mapping.api.DynamicConfigurationKey”>

<xsl:output indent=”no” />
<xsl:param name=”inputparam”/>

<xsl:template match=”/”>

<!– change dynamic configuration –>
<xsl:variable name=”dynamic-conf”
select=”map:get(xsltc:cast(‘java.util.Map’,$inputparam), ‘DynamicConfiguration’)” />
<xsl:variable name=”dynamic-key”
select=”key:create(‘http://sap.com/xi/XI/System/File’, ‘Directory’)” />
<xsl:variable name=”dynamic-value”
select=”dyn:get(xsltc:cast(‘com.sap.aii.mapping.api.DynamicConfiguration’,$dynamic-conf), $dynamic-key)” />
<xsl:variable name=”new-value”
select=”concat($dynamic-value, ‘subfolder’)” />
<xsl:variable name=”dummy”
select=”dyn:put(xsltc:cast(‘com.sap.aii.mapping.api.DynamicConfiguration’,$dynamic-conf), $dynamic-key, $new-value)” />

<!– copy payload –>
<xsl:copy-of select=”.” />
</xsl:template>

</xsl:stylesheet>