One of my friends Sergei reached out the other day and asked if id give him a 2nd pair of eyes on an error he was seeing. The problem he was having is the below error message. This error really doesnt say much at all.

{
  "Code": "InvalidXsltContent",
  "Message": "An error occurred while transforming the given input with the provided map. Details: 'net.sf.saxon.trans.XPathException: Errors were reported during stylesheet compilation'.",
  "Details": [
    {
      "Code": "InvalidXsltContent",
      "Message": "{\"StatusCode\":400,\"ErrorCode\":7,\"Details\":null,\"Message\":\"An error occurred while transforming the given input with the provided map. Details: 'net.sf.saxon.trans.XPathException: Errors were reported during stylesheet compilation'.\",\"Data\":{},\"InnerException\":null,\"StackTrace\":\"   at Microsoft.Azure.Function.Xslt30Transform.BaseXslt30Transformer.<Transform>d__3.MoveNext() in C:\\\\__w\\\\1\\\\s\\\\src\\\\functions\\\\Scripts\\\\Function.Common.Cloud\\\\Xml\\\\BaseXslt30Transformer.cs:line 76\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\\r\\n   at Microsoft.Azure.Function.Xslt30Transform.Xslt30TransformRequestProcessor.<ProcessTransformRequest>d__2.MoveNext() in C:\\\\__w\\\\1\\\\s\\\\src\\\\functions\\\\Scripts\\\\Function.Xslt30Transform\\\\Xslt30TransformRequestProcessor.cs:line 53\",\"HelpLink\":null,\"Source\":\"Microsoft.Azure.Function.Common.Cloud\",\"HResult\":-2146233088}",
      "Details": null,
      "InnerError": null
    }
  ],
  "InnerError": null
}

What was happening was a migration of a Logic App from the SAP connector to the calling SAP via HTTP. The map needed a small change to support this. In the map there was a small compilation error but it wasnt obvious what it was. Sergei had simplified the map right down to a simpler version which did very little work to try and rule stuff out. The simplified map looked like below.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cdm="http://interpipeline.com/eai/cdm/fiDocument" xmlns:pidx="http://www.pidx.org/schemas/v1.61" version="2.0" exclude-result-prefixes="rfc cdm pidx">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:param name="pFIDocument"/>
<xsl:template match="/*">
<FIDocumentProcessingResult> </FIDocumentProcessingResult>
</xsl:template>
</xsl:stylesheet>

With the map still now working and we know its some kind of compilation error we knew it was probably something with the structure of the template and maybe not so much with the content of the transformation.

I spotted that the exclude prefixed had a prefix in it “rfc” which was not declared as a namespace. It looks like you can upload an invalid map to the integration account and then you wouldnt see the compilation error until the map is executed.

The missing namespace was the one from when the map was used with the SAP connector = xmlns:rfc=”http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/”

The fix was to remove the text in red in the exclude-result-prefixes attribute

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cdm="http://interpipeline.com/eai/cdm/fiDocument" xmlns:pidx="http://www.pidx.org/schemas/v1.61" version="2.0" exclude-result-prefixes="rfc cdm pidx">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:param name="pFIDocument"/>
<xsl:template match="/*">
<FIDocumentProcessingResult> </FIDocumentProcessingResult>
</xsl:template>
</xsl:stylesheet>

Sometimes you dont see things when you look at them too much and its great to reach out to your friend network for a 2nd pair of eyes who might spot something when looking at a problem fresh.

Hopefully this post saves someone a bit of troubleshooting time.

 

Buy Me A Coffee