Azure Logic App Standard workflow fails to execute XSLT

Abhishek Verma 26 Reputation points
2025-06-12T18:53:36.54+00:00

Workflow using Transform XML action to execute the XSLT. XSLT got 4 inline C# function. One function throwing the error. I cant see any issue with the XSLT and error message is not much help.

XSLT inline function

public string FormatDate(string inPutdate)
		{
			string formattedDate = string.Empty;
			if (DateTime.TryParseExact(inPutdate, "yyyy-MM-dd", new System.Globalization.CultureInfo("en-GB"), System.Globalization.DateTimeStyles.None, out DateTime date)) 
				{
					formattedDate = date.ToString("yyyy-MM-dd"); 
				}
			return formattedDate;
		}

Error :

[2025-06-12T18:39:15.493Z] XSLT is invalid ) expected

[2025-06-12T18:39:15.493Z] Result: XSLT is invalid ) expected

Exception: System.Xml.Xsl.XslLoadException: ) expected An error occurred at (291,158).

[2025-06-12T18:39:15.494Z] at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)

[2025-06-12T18:39:15.495Z] at Microsoft.Azure.Workflows.BuiltIn.Xslt.NetFx.Providers.XsltNetFxBuiltInOperationsProvider.<GetProcessedXslt>d__30.MoveNext() in C:__w\1\s\src\functionWorkers\builtIn\BuiltIn.Xslt.NetFx\Providers\XsltNetFxBuiltInOperationsProvider.cs:line 258

Stack: at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)

[2025-06-12T18:39:15.496Z] at Microsoft.Azure.Workflows.BuiltIn.Xslt.NetFx.Providers.XsltNetFxBuiltInOperationsProvider.<GetProcessedXslt>d__30.MoveNext() in C:__w\1\s\src\functionWorkers\builtIn\BuiltIn.Xslt.NetFx\Providers\XsltNetFxBuiltInOperationsProvider.cs:line 258.

[2025-06-12T18:39:15.579Z] Executed 'Functions.XsltNetFxLanguageWorkerFunction' (Succeeded, Id=0a230d4d-b43f-475a-a8a6-c9b6f749b0f0, Duration=721ms)

[2025-06-12T18:39:15.611Z] Job error: correlationId='152b3371-871a-4ea9-b75f-7231f3201a0c', operationName='XsltActionJob.ExecuteAction', jobPartition='7DA189ADF7C64464B5382F4B4F837413:2D08584518533325190132914236647CU00', jobId='08584518533325190132914236647CU00-INITIALIZE:3A5FMESSAGEID', message='XsltAction failed with handled exception.', exception='Microsoft.Azure.Workflows.Common.ErrorResponses.ErrorResponseMessageException: System.Xml.Xsl.XslLoadException: ) expected An error occurred at (291,158).

[2025-06-12T18:39:15.612Z] at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)

[2025-06-12T18:39:15.613Z] at Microsoft.Azure.Workflows.BuiltIn.Xslt.NetFx.Providers.XsltNetFxBuiltInOperationsProvider.<GetProcessedXslt>d__30.MoveNext() in C:__w\1\s\src\functionWorkers\builtIn\BuiltIn.Xslt.NetFx\Providers\XsltNetFxBuiltInOperationsProvider.cs:line 258

[2025-06-12T18:39:15.614Z] at Microsoft.Azure.Workflows.Languages.Edge.NetFx.Engines.NetFxRuntimeEngine.RunNetFxWorkerFunction(String functionName, JToken input, CancellationToken cancellationToken)

[2025-06-12T18:39:15.615Z] at Microsoft.WindowsAzure.ResourceStack.Common.Extensions.AsyncExtensions.ThenTInput,TOutput

[2025-06-12T18:39:15.616Z] at Microsoft.Azure.Workflows.Worker.Jobs.XsltActionJob.<>c__DisplayClass10_0.<<ExecuteAction>b__0>d.MoveNext()

[2025-06-12T18:39:15.616Z] --- End of stack trace from previous location ---

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Praveen Kumar Gudipudi 1,875 Reputation points Microsoft External Staff Moderator
    2025-06-13T11:12:22.76+00:00

    Hello Abhishek Verma,

    Thanks for reaching out,

    It sounds like you’re dealing with an issue in your Azure Logic App related to a Transform XML action, specifically with an XSLT that includes inline C# functions. The error message you're seeing, ) expected An error occurred at (291,158), typically indicates a syntax issue in your XSLT or the C# inline function.

    Here’s what you can try to troubleshoot this issue:

    Check XSLT Syntax: Make sure that your XSLT code is syntactically correct. Look for any missing closing tags, brackets, or any other misplaced syntax elements around line 291, column 158.

    Review Inline C# Function: The C# function you shared seems to be focusing on formatting a date. Confirm that the function is appropriately defined for its usage within the XSLT. Here’s a basic checklist:

    • Ensure the function is accessible and correctly referenced in the XSLT.
      • Validate that the input parameters being passed to the function are of the expected format.
      Simplify Your XSLT: Temporarily simplify your XSLT by commenting out the C# function calls to see if the error persists. This can help isolate whether the issue is with the inline function or the XSLT itself. Test Function Independently: If you can, create a simple test outside of the Logic App where you directly call the inline function with various sample inputs to ensure it behaves as expected. Check for Unmatched Parentheses: Specifically, the error message suggests there might be unmatched parentheses. Carefully go through the entire XSLT file to ensure that every opening parenthesis has a corresponding closing one.

    If the problem still exists after these checks, could you provide more details about the XSLT you're using? Specifically, any complicated structures or additional inline functions might help diagnose the issue better.

    Please check the XSLT syntax and let us know with an update.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.