Skip to content
LambogeniusDocs

Compose using XSLT for Azure Logic Apps

Parameters and variables

Pass xsl:param values from the trigger, workflow variables or expressions, and pick maps dynamically.

Service provider/serviceProviders/lamboXsltComposeOperation ComposeXslt, shown in the designer as Compose using XSLT.

Parameters

parameters is an object whose names match the map's xsl:param elements. Values can be literals or any expression: query strings, headers, earlier actions, or workflow variables.

Workflow valueXSLT typeExample
stringstring"currency": "@variables('currency')"
integer, floatnumber (double)"maxLines": "@variables('maxLines')"
booleanboolean<xsl:if test="$expedite">

Up to 64 parameters. Names are unqualified. null, arrays and objects are rejected; a parameter the map does not declare is ignored. Numbers become XPath doubles: pass a string when exact decimals matter.

Workflow variables

Variables of every type map straight onto parameters:

"Initialize_maxLines": {
  "type": "InitializeVariable",
  "inputs": { "variables": [ { "name": "maxLines", "type": "integer",
    "value": "@int(coalesce(triggerOutputs()?['queries']?['maxLines'], '10'))" } ] }
},
"Compose_using_XSLT": {
  "type": "ServiceProvider",
  "inputs": {
    "parameters": {
      "content": "@{triggerBody()}",
      "mapSource": "deployed",
      "mapName": "invoices/order-to-invoice.xslt",
      "parameters": {
        "currency": "@variables('currency')",     // string  -> XPath string
        "taxRate":  "@variables('taxRate')",      // float   -> number
        "expedite": "@variables('expedite')",     // boolean -> boolean: <xsl:if test="$expedite">
        "maxLines": "@variables('maxLines')"      // integer -> number
      }
    },
    …
  }
}

Results back into variables

  • Read a value from XML output: xpath(xml(body('Compose_using_XSLT')?['result']), 'string(/Invoice/Total)').
  • Route on it: a map with text output can return a decision (auto, review, reject) that a Switch acts on.
  • Pick the map at run time: mapName accepts an expression, such as @variables('mapName').

Loops

Split a batch with xpath(), transform each item, and collect the results:

"For_each_order": {
  "type": "Foreach",
  "foreach": "@xpath(xml(triggerBody()), '/Batch/Order')",
  "actions": {
    "Compose_using_XSLT": { … "content": "@{xml(items('For_each_order'))}" … },
    "Append_to_summaries": { "type": "AppendToArrayVariable",
      "inputs": { "name": "summaries", "value": "@body('Compose_using_XSLT')?['result']" } }
  },
  "runtimeConfiguration": { "concurrency": { "repetitions": 1 } }
}

xpath() returns each node as an XML object; xml(items('…')) turns it back into text for content. Keep the loop sequential when it updates variables.