Select nodes from target response XML specified in querystring parameter as comma separated string

I have a Target API that returns XML. Ask is to return selected nodes from XML based on querystring parameter containing list of node names as comma separated string

Example

{url}?fieldlist=n1,n2,n3

the proxy should return just these three child nodes.

Solved Solved
0 2 393
1 ACCEPTED SOLUTION

You can do this with a bit of XSL magic.

In the attached proxy, you'll find an XSL that expects a parameter fieldlist, tokenizes this parameter, and for each token, will output any direct child of the XML source root element with a matching name (if there are multiple children, it'll output all of them).

The proxy sets a dummy response XML with elements n1,n2,n3,n4 and n5, you can test it by setting query param fieldname to any combination of these names (separated by ',')filterxml-rev2-2018-10-08.zip

View solution in original post

2 REPLIES 2

You can do this with a bit of XSL magic.

In the attached proxy, you'll find an XSL that expects a parameter fieldlist, tokenizes this parameter, and for each token, will output any direct child of the XML source root element with a matching name (if there are multiple children, it'll output all of them).

The proxy sets a dummy response XML with elements n1,n2,n3,n4 and n5, you can test it by setting query param fieldname to any combination of these names (separated by ',')filterxml-rev2-2018-10-08.zip

Thanks so Much @deboraelkin, It worked well.