I'd like to execute a simple xslt template on my inbound policy as follows:
<policies>
<inbound>
<base />
<xsl-transform>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
{
"requestConfig": {
"businessArea": "HousingRents",
"callingSystem": "CX_Housing",
"callingSystemRef": "<xsl:value-of select="messages/accountreference" />",
"targetPhoneNumber": "<xsl:value-of select="messages/message/to" />"
},
"messageBody": "<xsl:value-of select="messages/message/body" />"
}
</xsl:template>
</xsl:stylesheet>
</xsl-transform>
<rewrite-uri template="https://xxx.azurewebsites.net/v1.0/simple-sms" />
<set-header name="x-functions-key" exists-action="override">
<value>xxx</value>
</set-header>
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
I test the api from the portal passing the following as a message body:
<messages>
<accountreference>ac1</accountreference>
<message>
<to>xxx</to>
<body>test message</body>
</message>
</messages>
This gives the error:
Invalid Xml passed to transform: Data at the root level is invalid. Line 2, position 21.
Anyone see the problem?