Regarding the XSL transform policy - Can i specify the Source with a variable?

Can i put a variable as a Source on the XSL transform policy or does it allow "request" as source only. I made a service callout and tried to use the response variable from service callout as Source on transform policy and it is giving error saying the source is not valid

Solved Solved
0 3 351
1 ACCEPTED SOLUTION

Yes it works just fine. A working example is attached.

apiproxy.zip

Import and Deploy it, then invoke it like this:

curl -i https://ORG-ENV.apigee.net/xsl-on-message/t1

You will see the output of the XSL transform, performed on a message that was assigned via AssignMessage.


Show us your policy config for the ServiceCallout and for the XSL policy. Maybe we can help diagnose what's wrong.

By the way, one thing that catches people is the Content-Type. if the content-type header on the Response from the ServiceCallout is not set to an XML type (like text/xml or application/xml) then the XSL will not run. It will just get skipped.

View solution in original post

3 REPLIES 3

Yes it works just fine. A working example is attached.

apiproxy.zip

Import and Deploy it, then invoke it like this:

curl -i https://ORG-ENV.apigee.net/xsl-on-message/t1

You will see the output of the XSL transform, performed on a message that was assigned via AssignMessage.


Show us your policy config for the ServiceCallout and for the XSL policy. Maybe we can help diagnose what's wrong.

By the way, one thing that catches people is the Content-Type. if the content-type header on the Response from the ServiceCallout is not set to an XML type (like text/xml or application/xml) then the XSL will not run. It will just get skipped.

Thank you much Dino! Setting the content-type to application/xml did the trick. I am guessing it is not possible to use multiple variable as a source on XSL transform. I wanted to mash up multiple responses using xslt