2024 Update Rollup 2

Available XLST Based ActionsPermanent link for this heading

Fabasoft Folio provides XSLT based actions for import and export. Additionally, an action for standard XSLT processing based on XML input and output is available.

XSLTransformObjectPermanent link for this heading

XSLTransformObject is used to export objects to an XML document.

COOXML@1.1:XSLTransformObject(
  
any[] value,
  
any[] xsltfile,
  
optional string resultfile,
  
optional dictionary parameter,
  
optional out content resultcontent,
  
optional COOXML@1.1:XMLParser xmlparser)

Parameters:

  • value
    Defines an arbitrary Fabasoft Folio object that should be transformed.
    Example: coort.GetObject("COO.1.506.1.10126")
  • xsltfile
    Defines the XSLT document used for the transformation. It can be a file path, a content or a content object.
    Example:
    "C:/trans/ExportXSLTransformation.xsl" (file path) #ExportXSLTransformation.content.contcontent (content)
    #ExportXSLTransformation (content object)
  • resultfile
    Defines the file path of the result XML file. Alternatively, the result is stored in resultcontent, if this parameter is omitted.
  • parameter
    Defines a dictionary that can contain options for the transformation.
  • resultcontent
    Contains the result XML data, if the resultfile parameter is omitted.
  • xmlparser
    Defines the XML parser that should be used. Available parsers are: XMLPARSER_DEFAULT, XMLPARSER_MSXML, XMLPARSER_LIBXML.

Note: Keep in mind that the defined file paths belong to the server running the Fabasoft Folio Web Services. File paths may be useful in combination with temporary files. In a development and testing environment (when having access to the file system) it may fasten the development process.

XSLTransformToObjectPermanent link for this heading

XSLTransformToObject is used to create or update objects from an XML document.

COOXML@1.1:XSLTransformToObject(
  
any[] xmlfile,
  
any[] xsltfile,
  
optional string metaxmlfile,
  
optional dictionary parameter,
  
optional out content resultcontent,
  
optional COOXML@1.1:XMLParser xmlparser)

Parameters:

  • xmlfile
    Defines the source XML document used for the transformation. It can be a file path, a content or a content object.
  • xsltfile
    Defines the XSLT document used for the transformation. It can be a file path, a content or a content object.
  • metaxmlfile
    Defines the file path of the meta XML file. Alternatively, the meta XML data is stored in resultcontent, if this parameter is omitted.
    The meta XML data is only a by-product of the transformation. Creating or modifying objects in Fabasoft Folio is the main purpose of the XSL transformation and not to transform the source XML to a target document. Thus the target document is called “meta” because it is technically needed for the XSLT process, but it is not the wanted result.
  • parameter
    Defines a dictionary that can contain options for the transformation.
  • resultcontent
    Contains the meta XML data, if the metaxmlfile parameter is omitted.
  • xmlparser
    Defines the XML parser that should be used. Available parsers are: XMLPARSER_DEFAULT, XMLPARSER_MSXML, XMLPARSER_LIBXML.

Note:

  • XSLTransformToObject only provides a limited set of XSLT functionality. Within a property block (e.g. <sys:objname>My Name</sys:objname>) no xsl:if or xsl:when blocks are allowed.
  • Keep in mind that the defined file paths belong to the server running the Fabasoft Folio Web Services. File paths may be useful in combination with temporary files. In a development and testing environment (when having access to the file system) it may fasten the development process.

XSLTransformPermanent link for this heading

XSLTransform is used to perform an XSL transformation using a standard XSLT processor. Input and output are based on XML. This action can also be used to pre-process XML input for XSLTransformToObject or post-process XML output from XSLTransformObject, because these actions only provide a limited set of XSLT functionality.

COOXML@1.1:XSLTransform(
  
any[] source,
  
any[] transform,
  
optional out content result,
  
optional dictionary parameters,
  
optional string filename)

Parameters:

  • source
    Defines the source XML document used for the transformation. It can be a file path, a content or a content object.
  • transform
    Defines the XSLT document used for the transformation. It can be a file path, a content or a content object.
  • result
    Contains the XML data, if the filename parameter is omitted.
  • parameters
    Defines a dictionary that can contain options for the transformation.
  • filename
    Defines the file path of the XML file. Alternatively, the XML data is stored in result, if this parameter is omitted.

Using ParametersPermanent link for this heading

Both XSLTransformObject and XSLTransformToObject provide the possibility to use a parameters dictionary. The dictionary is available in the global scope when using the sys:Evaluate function (see chapter “sys:Evaluate”). Another way to access the dictionary is to define an xsl:param with the same name as the dictionary key.

Example

app.ducx Use Case Language

menu usecase Export on selected {
  variant Object {
    impl = expression {
      // dictionary that should be available in the XSLT context
      dictionary @dict;
      @dict.key1 = "valuekey1";
      coouser.XSLTransformObject(cooobj, "c:/trans/export.xsl",
        "c:/trans/result.xml", @dict);
    }
  }
}

export.xsl

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sys="http://www.fabasoft.com/components/COOSYSTEM@1.1">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
   omit-xml-declaration="no" />
  <!-- make the dictionary key available as xsl:param -->
  <xsl:param name="key1" />
  <xsl:template match="/">
    <root>
      <approach1>
        <!-- use xsl:param -->
        <xsl:value-of select="$key1" />
      </approach1>
      <approach2>
        <!-- use sys:Evaluate and access the dictionary in the global scope -->
        <xsl:value-of select="sys:Evaluate('::key1')" />

      </approach2>
    </root>
  </xsl:template>
</xsl:stylesheet>

The output looks like this:

Example

result.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
  <approach1>valuekey1</approach1>
  <approach2>valuekey1</approach2>
</root>

Note: In complicated cases it may be easier to transport the objects that have to be exported in the parameters dictionary. In this way you can classify and filter the objects beforehand in the app.ducx project and therefore remove complexity from the XSLT document.