xml - xsi:type attribute does not bound to any namespace -
i trying generate xml response xml using style sheet. not able generate desired outcome. seems issue xsi:type attribute. can suggest possible change in 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 , quantityonhand element hold value of platformcommon:itemid , platformcommon:quantityonhand element of origina response.
below xsl file 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>
there's nothing can stylesheet make accept ill-formed xml. xml source contains
<platformcore:searchrow xsi:type="listacct:itemsearchrow" xmlns:listacct="urn:accounting_2015_1.lists.webservices.netsuite.com">
and xsi prefix isn't declared. need fix xml.
Comments
Post a Comment