I am trying to generate an xml from a response xml using a style sheet. But not able to generate the desired outcome. It seems the issue is with the xsi:type attribute. Can anybody suggest a possible change in the style sheet.
Source XML
<soapenv:Body>
<searchResponse>
<platformCore:searchResult xmlns:platformCore="urn:core_2015_1.platform.webservices.netsuite.com">
<platformCore:status isSuccess="true"/>
<platformCore:totalRecords>17403</platformCore:totalRecords>
<platformCore:pageSize>1000</platformCore:pageSize>
<platformCore:totalPages>18</platformCore:totalPages>
<platformCore:pageIndex>1</platformCore:pageIndex>
<platformCore:searchId>WEBSERVICES_3479023_SB2_050620156958981381039449122_c4911d7b</platformCore:searchId>
<platformCore:searchRowList>
<platformCore:searchRow xsi:type="listAcct:ItemSearchRow" xmlns:listAcct="urn:accounting_2015_1.lists.webservices.netsuite.com">
<listAcct:basic xmlns:platformCommon="urn:common_2015_1.platform.webservices.netsuite.com">
<platformCommon:internalId>
<platformCore:searchValue internalId="2298"/>
</platformCommon:internalId>
<platformCommon:itemId>
<platformCore:searchValue>00411335</platformCore:searchValue>
</platformCommon:itemId>
<platformCommon:quantityAvailable>
<platformCore:searchValue>3721.0</platformCore:searchValue>
</platformCommon:quantityAvailable>
<platformCommon:quantityOnHand>
<platformCore:searchValue>3721.0</platformCore:searchValue>
</platformCommon:quantityOnHand>
</listAcct:basic>
</platformCore:searchRow>
<platformCore:searchRow xsi:type="listAcct:ItemSearchRow" xmlns:listAcct="urn:accounting_2015_1.lists.webservices.netsuite.com">
<listAcct:basic xmlns:platformCommon="urn:common_2015_1.platform.webservices.netsuite.com">
<platformCommon:internalId>
<platformCore:searchValue internalId="20284"/>
</platformCommon:internalId>
<platformCommon:itemId>
<platformCore:searchValue>0117022</platformCore:searchValue>
</platformCommon:itemId>
<platformCommon:quantityAvailable>
<platformCore:searchValue>545.0</platformCore:searchValue>
</platformCommon:quantityAvailable>
<platformCommon:quantityOnHand>
<platformCore:searchValue>551.0</platformCore:searchValue>
</platformCommon:quantityOnHand>
</listAcct:basic>
</platformCore:searchRow>
................. .................
Desired Outcome
<soapenv:Body>
<updateList>
<updateItem>
<itemCode></itemCode>
<quantityOnHand></quantityOnHand>
</updateItem>
<updateItem>
<itemCode></itemCode>
<quantityOnHand></quantityOnHand>
</updateItem>
<updateItem>
<itemCode></itemCode>
<quantityOnHand></quantityOnHand>
</updateItem>
................
........
</updateList>
The itemCode and quantityOnHand element will hold the value of platformCommon:itemId and platformCommon:quantityOnHand element of origina response.
Below is the XSL file I am using.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:platformCore="urn:core_2015_1.platform.webservices.netsuite.com"
xmlns:listAcct="urn:accounting_2015_1.lists.webservices.netsuite.com"
xmlns:platformCommon="urn:common_2015_1.platform.webservices.netsuite.com" xmlns:soapenv ="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<soapenv:Body>
<updateList>
<xsl:for-each select="soapenv:Body/searchResponse/platformCore:searchResult/platformCore:searchRowList/platformCore:searchRow">
<updateItem>
<itemCode>
<xsl:value-of select="listAcct:basic/platformCommon:itemId/platformCore:searchValue"/>
</itemCode>
<quantityOnHand>
<xsl:value-of select="listAcct:basic/platformCommon:itemId/platformCore:searchValue"/>
</quantityOnHand>
</updateItem>
</xsl:for-each>
</updateList>
</soapenv:Body>
</xsl:template>
</xsl:stylesheet>