Please enable JavaScript to view this site.

Altova MapForce 2020 Enterprise Edition

This example illustrates how to import custom XSLT 1.0 functions into MapForce. The files needed for this example are available in the <Documents>\Altova\MapForce2020\MapForceExamples\ directory.

 

Name-splitter.xslt. This XSLT file defines a named template called "tokenize" with a single parameter "string". The template works through an input string and separates capitalized characters with a space for each occurrence.

Name-splitter.xml (the source XML instance file to be processed)

Customers.xsd (the source XML schema)

CompletePO.xsd (the target XML schema)

To add a custom XSLT function:

1.Click the Add/Remove Libraries button at the base of the Libraries window. The Manage Libraries window opens.

mf_manage_libraries_window_empty

2.Do one of the following:

 

To import functions as a local library (in the scope of the current document only), click the Add button under the current mapping name.

To import functions as a global library (at program level), click the Add button adjacent to Global Library Imports.

 

Note:When you import a library locally, you can set the path of the library file to be relative to the mapping file. With globally imported libraries, the path of the imported library is always absolute.

 

3.Browse for the .xsl or .xslt file that contains the named template you want to act as a function, in this case Name-splitter.xslt, and click Open. A message box appears informing you that a new library has been added, and the XSLT file name appears in the Libraries window, along with the functions defined as named templates (in this example, Name-splitter with the tokenize function).

mf_import_xslt_example_01

To use the XSLT function in your mapping:

1.Drag the tokenize function into the Mapping window and map the items as show below.

mf_import_xslt_example_02

2.Click the XSLT tab to see the generated XSLT code.

mf_import_xslt_example_03

Note:As soon as a named template is used in a mapping, the XSLT file containing the named template is included in the generated XSLT code (xsl:include href...), and is called using the command xsl:call-template.

 

3.Click the Output tab to see the result of the mapping.

To remove custom XSLT libraries from MapForce:

1.Click Add/Remove Libraries at the base of the Libraries window. The Manage Libraries window opens.

2.Click Delete Library mf_ic_delete_library next to the library that is to be deleted.

© 2020 Altova GmbH