Please help me for XSLT code which will work in DataPower for following input
Input: {
"Timestamp": "2018-12-19T10:52:21.0870605-05:00",
"ResponseType": "Success",
"Name": [
{
"Code": "1001",
"Description": "ABC",
"Number": "123"
},
{
"Code": "1002",
"Description": "XYZ",
"Number": "123"
},
{
"Code": "1003",
"Description": "PQA",
"Number": "123"
},
{
"Code": "1004",
"Description": "MNO",
"Number": "123"
}
]
}
Output:
XSLT Variable
xsl:variable_code = 1001,1002,1003,1004
xsl:variable_Name : ABC,XYZ,PQA,MNO
XSLT will not work with this format natively (XSLT input is always XML, but output can be whatever).
There are ways to get around this.
1 - Use Gatewayscript transformation instead. You can find example on your own Datapower "sample" folders". The files are ending with ".js"
2 - You can still do it in XSLT, but need to auto-convert the JSON to XML using the input settings and a special, hidden, magic variable. How-to:
Here is an example of the conversion.
The rest is just normal XSLT programming on the Datapower... you can create a JSON or XML output... your choice !