XSLT to convert a xml document back to xml
This is an open discussion with 3 replies, filed under XSLT.
Search
Looks like the copy paste didn’t work properly
Intial xml is
<SearchResultsAddressDataSet xmlns="http://tempuri.org/SearchResultsAddressDataSet.xsd"> <AddressResults><ID>10</ID><Country>Aruba</Country><PostalCode>CA 94555-3658</PostalCode><Deleted>N</Deleted><lAddressLines>test text xyz</lAddressLines></AddressResults> <AddressResults><ID>10</ID><Country>Aruba</Country><PostalCode>CA 94555-3658</PostalCode><Deleted>N</Deleted><lAddressLines>test temp</lAddressLines></AddressResults> <AddressResults><ID>10</ID><Country>Aruba</Country><PostalCode>CA 94555-3658</PostalCode><Deleted>N</Deleted><lAddressLines>test3 gtrgtrrthyty</lAddressLines></AddressResults> <AddressResults><ID>11</ID><Country>UK</Country><PostalCode>CA 9fd5-3658</PostalCode><Deleted>N</Deleted><lAddressLines>test</lAddressLines></AddressResults></SearchResultsAddressDataSet>
the resultant xml :
<SearchResultsAddressDataSet xmlns="http://tempuri.org/SearchResultsAddressDataSet.xsd"> <AddressResults><ID>10</ID><Country>Aruba</Country><PostalCode>CA 94555-3658</PostalCode><Deleted>N</Deleted><lAddressLines>test text xyz,test temp,test3 gtrgtrrthyty</lAddressLines></AddressResults> <AddressResults><ID>11</ID><Country>UK</Country><PostalCode>CA 9fd5-3658</PostalCode><Deleted>N</Deleted><lAddressLines>test</lAddressLines></AddressResults></SearchResultsAddressDataSet>
Somehow the xml I am pasting is not appearing correctly
@Urvashi - Try using pastie.org and paste the url of the code here in the forum.
Create an account or sign in to comment.
Hello, I need to convert an xml document back to same type but with the exception that all the addresses with the same id having different address lines be converted into a comma separated list. So the following xml
10ArubaCA 94555-3658Ntest text xyz10ArubaCA 94555-3658Ntest temp10ArubaCA 94555-3658Ntest3 gtrgtrrthyty11UKCA 9fd5-3658Ntest
be converted into
10ArubaCA 94555-3658Ntest text xyz,test temp,test3 gtrgtrrthyty11UKCA 9fd5-3658Ntest
Thanks in advance