Hi All,,
I have output like below from my xslt :
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";> <soapenv:Body> 
<Result> <Detail> <a>40</a> <b>car</b> <c>2019-01-17T00:00:00</c> </Detail> 
<Detail> <a>37</a> <b>table</b> <c>2019-01-17T00:00:00</c> </Detail> <Detail> 
<a>35</a> <b>book</b> <c>2019-01-17T00:00:00</c> </Detail> <Detail> <a>26</a> 
<b>box</b> <c>2019-01-17T00:00:00</c> </Detail> </Result> 
</soapenv:Body></soapenv:Envelope>
which gets converted into below json in postman :
{    "Result": {        "Detail": [            {                "a": "40",      
          "b": "car",                "c": "2019-01-17T00:00:00"            },   
         {                "a": "37",                "b": "table",               
 "c": "2019-01-17T00:00:00"            },            {                "a": 
"35",                "b": "book",                "c": "2019-01-17T00:00:00"     
       },            {                "a": "26",                "b": "box",     
           "c": "2019-01-17T00:00:00"            }        ]    }}
but in my desired output response . I do not want root element "Result".
Desired output :
{    "Detail": [            {                "a": "40",                "b": 
"car",                "c": "2019-01-17T00:00:00"            },            {     
           "a": "37",                "b": "table",                "c": 
"2019-01-17T00:00:00"            },            {                "a": "35",      
          "b": "book",                "c": "2019-01-17T00:00:00"            },  
          {                "a": "26",                "b": "box",                
"c": "2019-01-17T00:00:00"            }        ]    }}
Going through some online documents I tried below enrich after xslt.
<enrich>     <source clone="true" xpath="$body/Result/Detail"/>     <target 
type="body"/></enrich>
But it gives only one element from my output  like below :
{    "Detail": {        "insuranceNumber": "40",        "policyName": "Laptop 
insurance - 4 star",        "agreementValidTill": "2019-01-17T00:00:00"    }}
Please guide.
Thanks,Vikram
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to