Altova MapForce 2024 Professional Edition

Splits the input string into a sequence of strings. The size of each resulting string is determined by the length parameter.




Built-in, C++, C#, Java, XQuery, XSLT 2.0, XSLT 3.0.






The input string.


Determines the length of each string in the generated sequence of strings.



If the input string is ABCDEF and the length is 2, then the function returns a sequence of three strings: AB, CD, and EF.




In the mock-up mapping illustrated above, the function's result is a sequence of strings. According to the general mapping rules, for each item in the source sequence, a new item is created in the target component. Consequently, the mapping output looks as follows:





For a more elaborate example, see the tokenizeString2.mfd mapping available in the <Documents>\Altova\MapForce2024\MapForceExamples\ folder.



The XML source file is shown below, and is the same as the one used in the previous example. The MissionKit element has two attributes: Edition and ToolCodes, but no MissionKit element content. Note that some of the XML content not relevant to this example has been removed.


<?xml version="1.0" encoding="UTF-8"?>
<AltovaTools xmlns:xsi="" xsi:noNamespaceSchemaLocation="AltovaTools.xsd">
  <Tool Name="XMLSpy" Code="XS"><!--...--></Tool>
  <Tool Name="MapForce" Code="MF"><!--...--></Tool>
  <Tool Name="StyleVision" Code="SV"><!--...--></Tool>
  <Tool Name="UModel" Code="UM"><!--...--></Tool>
  <Tool Name="DatabaseSpy" Code="DS"><!--...--></Tool>
  <Tool Name="DiffDog" Code="DD"><!--...--></Tool>
  <Tool Name="SchemaAgent" Code="SA"><!--...--></Tool>
  <Tool Name="SemanticWorks" Code="SW"><!--...--></Tool>
  <Tool Name="Authentic" Code="AU"><!--...--></Tool>
  <MissionKit Edition="Enterprise Software Architects" ToolCodes="XSMFSVUMDSDDSASW"/>
  <MissionKit Edition="Professional Software Architects" ToolCodes="XSMFSVUMDS"/>
  <MissionKit Edition="Enterprise XML Developers" ToolCodes="XSMFSVDDSASW"/>
  <MissionKit Edition="Professional XML Developers" ToolCodes="XSMFSV"/>


The aim of the mapping is to generate a list showing which Altova tools are part of the respective MissionKit editions.


How the mapping works:


The SelectMissionKit input component acts as a parameter to the mapping; it receives its default value from a constant, in this case "Enterprise XML Developers".

The equal function compares the edition supplied as parameter with the Edition item from the source XML file and passes on the result to the bool parameter of the ToolCodes filter.

The node/row input of the ToolCodes filter is supplied by the ToolCodes item of the source file. The value for the "Enterprise XML Developers" edition is: XSMFSVDDSASW.

The XSMFSVDDSASW value is passed to the on-true parameter, and further to the input parameter of the tokenize-by-length function.

The tokenize-by-length function splits the value XSMFSVDDSASW into multiple chunks of two characters each. The length parameter is 2; therefore 6 chunks are created as a result.

Each chunk is compared to the 2-character Code value from the source file (of which there are 9 items in total). The result of the comparison (true/false) is passed on to the bool parameter of the filter. Note that all chunks produced by the tokenize-by-length function are passed on to the node/row parameter of the filter.

The exists functions now checks for existing/non-existing nodes passed on to it by the on-true parameter of the filter component. Existing nodes are those where there is a match between the ToolCodes chunk and the Code value. Non-existing nodes are those where there was no ToolCodes chunk to match a Code value.

Each bool result of the exists function is passed on to the if-else component, which generates a "Y" in the target if the node exists, or an "N" if the node does not exist.


The result of the mapping is as follows:


Tool;MissionKit for Enterprise XML Developers

© 2018-2024 Altova GmbH