Transform an order in five steps
- 1Get the package
from Downloads, save it in a folder such as
packages/, and make that folder a package source:<configuration> <packageSources> <add key="xslt-compose" value="packages" /> <!-- the folder holding the downloaded .nupkg --> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> </packageSources> </configuration> - 2Reference it
in a NuGet-based Logic Apps Standard project:
<ItemGroup> <PackageReference Include="Lambogenius.XsltCompose.LogicApps" Version="1.1.1" /> </ItemGroup>The package's build targets copy the XSLT worker to
xslt-worker/in the build and publish output. Thehost.jsonthe runtime reads must not have anextensionBundlesection, or the runtime ignores the project's packages; the samples remove it from the build and publish copies. - 3Add the connection and the settings.
{ "serviceProviderConnections": { "lamboXsltCompose": { "displayName": "Lambogenius XSLT", "serviceProvider": { "id": "/serviceProviders/lamboXsltCompose" }, "parameterValues": { "mapFolder": "" } } } }{ "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "dotnet", "APP_KIND": "workflowApp", "FUNCTIONS_INPROC_NET8_ENABLED": "1" } } - 4Add a map
as
Artifacts/Maps/orders/order-to-sales-order.xslt:<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:param name="currency" select="'CAD'"/> <xsl:template match="/Order"> <SalesOrder> <OrderNumber><xsl:value-of select="normalize-space(Number)"/></OrderNumber> <Currency><xsl:value-of select="$currency"/></Currency> <Lines><xsl:value-of select="count(Lines/Line)"/></Lines> </SalesOrder> </xsl:template> </xsl:stylesheet> - 5Create the workflow and run it.
{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "contentVersion": "1.0.0.0", "triggers": { "When_an_HTTP_request_is_received": { "type": "Request", "kind": "Http", "inputs": { "method": "POST" } } }, "actions": { "Compose_using_XSLT": { "type": "ServiceProvider", "inputs": { "parameters": { "content": "@{triggerBody()}", "mapSource": "deployed", "mapName": "orders/order-to-sales-order.xslt", "parameters": { "currency": "CAD" } }, "serviceProviderConfiguration": { "connectionName": "lamboXsltCompose", "operationId": "ComposeXslt", "serviceProviderId": "/serviceProviders/lamboXsltCompose" } }, "runAfter": {} }, "Response": { "type": "Response", "kind": "Http", "inputs": { "statusCode": 200, "headers": { "Content-Type": "@{body('Compose_using_XSLT')?['contentType']}" }, "body": "@body('Compose_using_XSLT')?['result']" }, "runAfter": { "Compose_using_XSLT": [ "Succeeded" ] } } }, "outputs": {} }, "kind": "Stateful" }Run
dotnet build, thenfunc startinbin/Debug/net8.0, and POST an order asapplication/xmlto the trigger URL. No license is needed underfunc start; before you deploy, get one (see Licensing).
The samples repository has four ready-made Logic Apps. ./run.ps1 builds and starts one, and ./demo.ps1 calls every workflow and checks the answers.