The basic functionality of the XML Merger component is to merge two XML data sets into one as follows: There is a 'main'-XML data set (input channel "XML"). The complete XSLT mapping will be described regarding this XML dataset. All integrating parts of another XML data set (input channel "XML to integrate") will be described with a 'document'-reference in XSLT mapping.
As XSLT is a standard technology in the field of information technology it is referred to corresponding literature available. As a technical background, the approach used is based on Saxon processor. In the mapping file (see example) a XSLT-constant INTEGRATING_INPUT refers to the XML to integrate data channel.
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:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="xsi">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<!--Define Variable for integrated CPACS-->
<xsl:variable name="cpacsIntegratedDoc" select="'INTEGRATING_INPUT'"/>
<!--Copy complete Source to Result -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/cpacs/aircraft/configuration/trajectories/global">
<global>
<ReferenceTrajectoryUID>
<xsl:value-of select="document($cpacsIntegratedDoc)/cpacs/aircraft/configuration/trajectories/global/ReferenceTrajectoryUID"/>
</ReferenceTrajectoryUID>
<xsl:copy-of select="document($cpacsIntegratedDoc)/cpacs/aircraft/configuration/trajectories/global/ReferenceTrajectory"/>
<xsl:copy-of select="/cpacs/aircraft/configuration/trajectories/global/*"/>
</global>
</xsl:template>
</xsl:stylesheet>
Instead of using XSLT, the mapping rules can also be described in XML.
Example: XML mapping:
<?xml version="1.0" encoding="UTF-8"?>
<map:mappings xmlns:map="http://www.rcenvironment.de/2015/mapping" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<map:mapping>
<map:source>/cpacs/vehicles/aircraft/model/reference/area</map:source>
<map:target>/toolInput/data/var1</map:target>
</map:mapping>
<map:mapping mode="delete">
<map:source>/toolOutput/data/result1</map:source>
<map:target>/cpacs/vehicles/aircraft/model/reference/area</map:target>
</map:mapping>
</map:mappings>
RCE automatically determines which format is used based on the filename endings, so the mapping file name must end with ".xslt" or ".xml", respectively.