origam.com

Notification is not sent when there is an apostrophe in the email subject

I have a notification template in French that contains an apostrophe in the email subject. Even though it is escaped ('), the workflow that adds the entry to a work queue ends with an error, basically complaining about the apostrophe. When I move the escaped apostrophe to the body, the workflow runs through without problem.

In this example, the apostrophe is added both in the subject and body, but when testing it was either in the subject or the body.

<ROOT>
	  <OrigamNotification>
			 <xsl:attribute name="Subject">
				  <xsl:value-of select="concat($orgName,' - Ouverture d&apos;un compte client')"/>
			 </xsl:attribute>
			 <Body>&lt;html&gt;
Bon&apos;jour <xsl:value-of select="$customerFirstNameAndName"/>
&lt;br&gt;
&lt;br&gt;

The email body from the Mail queue:

<html>
Bon'jour xxx yyy
<br>
<br>

Log with the error:

2021-11-02 19:07:13,598 [30] ERROR Origam.Workflow.WorkflowHost - Origam.OrigamException: Expected token ')', found 'un '.
concat($orgName,' - Ouverture d' -->un <-- compte client')
 ---> System.Xml.Xsl.XslLoadException: Expected token ')', found 'un '.
concat($orgName,' - Ouverture d' -->un <-- compte client') An error occurred at , (0, 0).
   at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
   at System.Xml.Xsl.XslCompiledTransform.Load(IXPathNavigable stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
   at Origam.Rule.CompiledXsltEngine.GetTransform(String xsl) in D:\a\1\s\origam-source\Origam.Rule\CompiledXsltEngine.cs:line 59
   at Origam.Rule.AbstractXsltEngine.GetTransform(String xsl, Guid retransformTemplateId, Hashtable retransformationParameters, RuleEngine ruleEngine) in D:\a\1\s\origam-source\Origam.Rule\AbstractXsltEngine.cs:line 232
   at Origam.Rule.AbstractXsltEngine.Transform(IXmlContainer data, String xsl, Hashtable parameters, RuleEngine ruleEngine, IDataStructure outputStructure, Boolean validateOnly) in D:\a\1\s\origam-source\Origam.Rule\AbstractXsltEngine.cs:line 242
   at Origam.Workflow.WorkQueue.WorkQueueService.GenerateNotificationMessage(Guid notificationTemplateId, IXmlContainer notificationSource, DataRow recipientRow, DataRow workQueueRow, String transactionId) in D:\a\1\s\origam-source\Origam.Workflow\WorkQueue\WorkQueueService.cs:line 534
   at Origam.Workflow.WorkQueue.WorkQueueService.ProcessNotifications(WorkQueueClass wqc, Guid workQueueId, Guid eventTypeId, DataSet queueItem, String transactionId) in D:\a\1\s\origam-source\Origam.Workflow\WorkQueue\WorkQueueService.cs:line 417
   at Origam.Workflow.WorkQueue.WorkQueueService.WorkQueueAdd(String workQueueClass, String workQueueName, Guid workQueueId, String condition, IXmlContainer data, WorkQueueAttachment[] attachments, String transactionId) in D:\a\1\s\origam-source\Origam.Workflow\WorkQueue\WorkQueueService.cs:line 271
   at Origam.Workflow.WorkQueue.WorkQueueService.WorkQueueAdd(String workQueueName, IXmlContainer data, WorkQueueAttachment[] attachments, String transactionId) in D:\a\1\s\origam-source\Origam.Workflow\WorkQueue\WorkQueueService.cs:line 213
   at Origam.Workflow.WorkQueueServiceAgent.Add(IWorkQueueService wqs) in D:\a\1\s\origam-source\Origam.Workflow\Service Agents\WorkQueueServiceAgent.cs:line 176
   at Origam.Workflow.WorkQueueServiceAgent.Run() in D:\a\1\s\origam-source\Origam.Workflow\Service Agents\WorkQueueServiceAgent.cs:line 58
   at Origam.Workflow.Tasks.ServiceMethodCallEngineTask.OnExecute() in D:\a\1\s\origam-source\Origam.Workflow\Tasks\ServiceMethodCallEngineTask.cs:line 215
   at Origam.Workflow.ProfilingTools.<>c__DisplayClass4_0.<ExecuteAndLogDuration>g__FuncToExecute|0() in D:\a\1\s\origam-source\Origam.Workflow\ProfilingTools.cs:line 69
   at Origam.Workflow.ProfilingTools.ExecuteAndLogDuration(Func`1 funcToExecute, String logEntryType, String path, String id, Func`1 logOnlyIf) in D:\a\1\s\origam-source\Origam.Workflow\ProfilingTools.cs:line 108
   at Origam.Workflow.ProfilingTools.ExecuteAndLogDuration(Action action, String logEntryType, String path, String id, Func`1 logOnlyIf) in D:\a\1\s\origam-source\Origam.Workflow\ProfilingTools.cs:line 74
   at Origam.Workflow.Tasks.AbstractWorkflowEngineTask.MeasuredExecution() in D:\a\1\s\origam-source\Origam.Workflow\Tasks\AbstractWorkflowEngineTask.cs:line 105
   at Origam.Workflow.Tasks.ServiceMethodCallEngineTask.Execute() in D:\a\1\s\origam-source\Origam.Workflow\Tasks\ServiceMethodCallEngineTask.cs:line 71
   --- End of inner exception stack trace ---

I think what you actually want in your final XML is

Bon&apos;jour xxx yyy

No, the problem is the apostrophe in the subject.

Try creating a variable

<xsl:variable name="apos">'</xsl:variable>

and then using the $apos instead of &apos;

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.