I facing a big problem here of showing up nodes in a range/specific node using XSLT in datapower. The service is a REST service. The range/node number needs to be fetched from service URI. One of the URI is like below :-
http://{{servernameenter code here
}}:7120/pateint/encounter/labslist/all?patientId=mpUp6R2Z&sourceSystemId=MT_COCAA
Here, if we change the parameter "all" with some number say "10" then expectation is that the response should contain only 10th node of Encounter. That means response should filter it according to the parameter sent in URI.
The data is as follows :-
<Encounters>
<Encounter> <Encounter> -----1st occurance
<Encounter> <Encounter> -----2nd occurance
<Encounter> <Encounter> -----3rd occurance
<Encounter> <Encounter> -----4th occurance
<Encounter> <Encounter> -----5th occurance
<Encounter> <Encounter> -----6th occurance
<Encounters>
1) If we give "5" instead of "all" in URI "http://{{servername}}:7120/pateint/encounter/labslist/5?patientId=mpUp6R2Z&sourceSystemId=MT_COCAA" then we should get
<Encounters>
<Encounter> <Encounter> ----- 5th occurance
<Encounters>
2) If we give a range from "2 to 5" instead of "all" in URI "http://{{servername}}:7120/pateint/encounter/labslist/2-5?patientId=mpUp6R2Z&sourceSystemId=MT_COCAA" then we should get
<Encounters>
<Encounter> <Encounter> -----2nd occurance
<Encounter> <Encounter> -----3rd occurance
<Encounter> <Encounter> -----4th occurance
<Encounter> <Encounter> -----5th occurance
<Encounters>
3) If the range/number is outside total number of nodes present in response say "10" in current example which is more than maximum nodes of 6 or range "2-7" which is more than 6 again then it should through some HTTP error.
Is this achievable ? Can we make a generic XSLT for above so that it works fine for any list, not only encounter, be it Medication or anything else. It takes range/specific node number from service incoming URI and then filters out output according to it.
Thanks and Regards, Rohan