Layer7 API Management

Expand all | Collapse all

Is it possible to apply two XSL on one single incoming request of XML?

Jump to Best Answer
  • 1.  Is it possible to apply two XSL on one single incoming request of XML?

    Posted 09-01-2016 06:51 AM

    The scenario here is:

    I have a request with XML body and have two XSLTs. Both XSL files are to be applied on same incoming XML file.

    First Question here is "Is it possible to write two Apply XSLT assertion one after the other and will it take request XML in both the case on its own?"

    Then I want the first XML output to be stored somewhere in gateway server (in a folder) while second XML response is to be routed to some other server.

    How we can do.Can some one please help me with these.

     

    Hope i am clear in my question and is understandable.



  • 2.  Re: Is it possible to apply two XSL on one single incoming request of XML?
    Best Answer

    Posted 09-01-2016 03:41 PM

    Hey Sonia,

    It is possible to apply 2 stylesheets to the request as it comes into the gateway. 

    In the below amazing diagram(sarcasm), we can just feed the resulting message from the first stylesheet right into the second stylesheet and produce the 'Request1_modified' XML message that has had both Stylesheets applied.

     

    'Amazing Diagram 1'

    Request1 --> Stylesheet1-->Stylesheet2 -->Request1_Modified

     

    Now, I'm gonna need some more information on your use-case in regards to storing a Message while we also route to the backend.

     

    What is that 'Stored Message' eventually going to be used for?

     

    If it is going to be used in response processing, this isn't a big deal, we can keep that message in it's variable form, and use it how ever we wish against the response, but if you intend to break the stateless nature of the call in some form or fashion, we will need a little more details on what you're trying to accomplish, so we can recommend a solution.

     

    hope this helps!



  • 3.  Re: Is it possible to apply two XSL on one single incoming request of XML?

    Posted 09-07-2016 06:23 AM

    Hi Doyle,

    The stored message comprise of transaction id and transaction data only...I need to store that data temp in some location of temporarily...Then that location will be used in some XSLT ...So when applying XSLT to particular XML ,it will fetch that transaction id and data and route to intended server.



  • 4.  Re: Is it possible to apply two XSL on one single incoming request of XML?

    Posted 09-07-2016 10:56 AM

    So we can't store to the filesystem within policy...

    I'm trying to understand your use-case so i can make an alternate suggestion. 

     

    You have a Request that comes in ( Request1 ) and you want to apply two stylesheets to Request1, resulting in Output1 ( which only has stylesheet1 applied ) and Output2 ( which only has stylesheet2 applied).

     

    You want to route Output1 back to the Service Provider and you want to store Output2 locally.

     

    Is my understanding correct?

     

    Can i ask why you want to store Output2 Locally? It sounds like you are doing some sort of 'Stateful' transaction...

     

    Please provide more details if you want a suggestion of best-practices on how to do what you are trying to do and i'll do my best to help...

     

    but in short, we can't store messages from policy onto the filesystem of the gateway... the closest thing you can get to this is to leverage our 'Caching Assertions' ( Local or External ), or leverage a Database, which we can push/fetch from.

     

    Hope this helps,

     

    Doyle



  • 5.  Re: Is it possible to apply two XSL on one single incoming request of XML?

    Posted 09-14-2016 01:56 AM

    Thank you Doyle