XSLT - How to create (or update) a variable and use it in another policy

Not applicable

Hello,

My XSLT does some transformations and assigns values to a couple of variables. The next step is a service callout. Now, I don't want to make the service call if the value of those two variables are of certain values? How can I accomplish that?

I have to either create a variable in XSL and use it on my next step or update a context variable inside my XSLT so I can use it in subsequent steps.

Thanks in advance.

0 3 598
3 REPLIES 3

@Karl Marx ,

it's simple, Just add a policy condition in the <STEP> XML of the service callout policy to check those value before you execute the policy.

More about policy conditions see it in action here using Apigee 4 Minute Videos 4 Developer, https://www.youtube.com/watch?v=lmU95q7Z-iM

Read more about policy conditions here, https://docs.apigee.com/api-platform/reference/conditions-reference

-------------------------------

Anil Sagar

5997-screen-shot-2017-11-23-at-75916-pm.png Learn Apigee Concepts in 4 Minutes HandsOn

Thanks Anil - May be I didn't make myself clear. The condition on that step should have the variable that I updated in my XSLT step. As far as I understand any variable that I create inside XSLT policy can not be accessed outside of that policy.

You will need to assign these XSL variables into the output XML. You can then use an ExtractVariables policy to extract those variables and use them in conditions or anywhere else.