0

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?

Martin Honnen
  • 149,505
  • 6
  • 83
  • 100
Rob Bowman
  • 6,364
  • 19
  • 76
  • 162
  • I’m afraid not. – Rob Bowman Nov 22 '21 at 06:45
  • You can reach to Microsoft via [raise support ticket](https://azure.microsoft.com/en-in/support/create-ticket/), [Twitter @AzureSupport](https://twitter.com/AzureSupport) and also ask the same question on [Microsoft Q&A](https://docs.microsoft.com/en-us/answers/products/) – DeepDave-MT Nov 22 '21 at 06:49
  • Have you checked this? This might be the issue: https://stackoverflow.com/a/67264008 and https://stackoverflow.com/questions/730133/what-are-invalid-characters-in-xml – DeepDave-MT Nov 22 '21 at 08:23

0 Answers0