Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

XSLT Issue - Donot need XML Namespace at Element Level. Please Help

$
0
0

Inpput XML:

<MT_Superior_invoice xmlns=’abc.com'

xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'

xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>

    <Invoice_recs>

        <Invoice_header>

            <comp_code>8000</comp_code>

            <AP_text>SWS-8VXHR820120624</AP_text>

            <header_text>003000993020120624</header_text>

            <document_dt>20131115</document_dt>

            <posting_dt>20131115</posting_dt>

            <fiscal_year>2013</fiscal_year>

            <document_type>DB</document_type>

            <Reference_no>SWS-8VXHR8</Reference_no>

            <vendor_no>318992</vendor_no>

            <amount>6042.48</amount>

            <invoice_details>

               <Line_num>10</Line_num>

               <gl_account>633001</gl_account>

               <item_text>DWAIN Cochran</item_text>

               <cr_dr_ind>DB</cr_dr_ind>

               <tax_code>I1</tax_code>

               <tax_jurisdiction>WA1030000</tax_jurisdiction>

               <cost_center>801404</cost_center>

               <amount>680.0</amount>

            </invoice_details>

 

        </Invoice_header>

    </Invoice_recs>

</MT_Superior_invoice>

 

 

Output XML: (desired Structure)

 

<ns0:MT_Superior_invoice xmlns:ns0=abc.com' >

    <Invoice_recs>

        <Invoice_header>

            <comp_code>8000</comp_code>

            <AP_text>SWS-8VXHR820120624</AP_text>

            <header_text>003000993020120624</header_text>

            <document_dt>20131115</document_dt>

            <posting_dt>20131115</posting_dt>

            <fiscal_year>2013</fiscal_year>

            <document_type>DB</document_type>

            <Reference_no>SWS-8VXHR8</Reference_no>

            <vendor_no>318992</vendor_no>

            <amount>6042.48</amount>

            <invoice_details>

               <Line_num>10</Line_num>

               <gl_account>633001</gl_account>

               <item_text>DWAIN Cochran</item_text>

               <cr_dr_ind>DB</cr_dr_ind>

               <tax_code>I1</tax_code>

               <tax_jurisdiction>WA1030000</tax_jurisdiction>

               <cost_center>801404</cost_center>

               <amount>680.0</amount>

            </invoice_details>

 

        </Invoice_header>

    </Invoice_recs>

</MT_Superior_invoice>

 

 

XSLT Used:

<?xml version='1.0' ?>

<xsl:stylesheetversion="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="abc.com">

    <xsl:templatematch="/">

         <ns0:MT_Superior_invoice>

         

              <xsl:copy-ofselect="ns0:MT_Superior_invoice/node()"/>

              

         </ns0:MT_Superior_invoice>

    </xsl:template>

</xsl:stylesheet>

 

Above XSLT is adding namespace at element level as well ( removing ns0 in Copy-of Select not producing output ).

 

Need help in modifying above XSLT to produce output shown above( Desired output ).

Thanks for any help and highly appreciated.

 


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>