SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

XSLT sample to encode, decode XML file



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования -> Conversion
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Sep 13, 2008 5:32 pm    Post subject: XSLT sample to encode, decode XML file Reply with quote

Author: Steffen Fröhlich

This coding shows you a complete XSLT program with loops and variables.

XSLT programs can be used to read out and generate XML files.

As you can see in the first part of this program I used variables and later at description tag I used the explicit command to refer the right tag in the XML file.

Code:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
  <xsl:template match="INVOICES_BTM">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
        <XML_OUTPUT>
          <xsl:for-each select="INVOICE_BTM">
            <INVOICE_BTM>
            <HEAD>
            <xsl:variable name="head" select="INVOICE_HEAD" />
              <A_LANGUAGE>            <xsl:value-of select="$head/@LANGUAGE" />                </A_LANGUAGE>
              <A_DIRECT_DEBIT_QUAL>   <xsl:value-of select="$head/@DIRECT_DEBIT_QUALIFIER" />  </A_DIRECT_DEBIT_QUAL>
              <INV_DATE>    <xsl:value-of select="$head/INVOICE_DATE"/></INV_DATE>
              <INV_NUMBER>
              <xsl:variable name="number" select="$head/INVOICE_NUMBER" />
                  <NUMBER>   <xsl:value-of select="$number/NUMBER"/>   </NUMBER>
                  <EXTENSION><xsl:value-of select="$number/EXTENSION"/></EXTENSION>
                  <SEQUENCE> <xsl:value-of select="$number/SEQUENCE"/> </SEQUENCE>
              </INV_NUMBER>
              <CREDIT_DEBIT_QUALIFIER> <xsl:value-of select="$head/CREDIT_DEBIT_QUALIFIER"/></CREDIT_DEBIT_QUALIFIER>
              <CREDIT_DEBIT_LABEL>     <xsl:value-of select="$head/CREDIT_DEBIT_LABEL"/>    </CREDIT_DEBIT_LABEL>
              <BILLING_CURRENCY>       <xsl:value-of select="$head/BILLING_CURRENCY"/>      </BILLING_CURRENCY>
              <BASE_CURRENCY>          <xsl:value-of select="$head/BASE_CURRENCY"/>         </BASE_CURRENCY>
              <DUE_DATE>               <xsl:value-of select="$head/DUE_DATE"/>              </DUE_DATE>

              <INV_PARTIES>
              <xsl:variable name="inv_parties" select="$head/INVOICE_PARTIES" />
              <PAYEE>
              <xsl:variable name="payee" select="$inv_parties/PAYEE" />
                  <PARTYCODE><xsl:value-of select="$payee/PARTYCODE"/></PARTYCODE>
                  <ADDRESS>
                  <xsl:variable name="address" select="$payee" />

                      <xsl:for-each select="$address/ADDRESSLINE">
                          <ADDRESSLINE>  <xsl:value-of select="."/>  </ADDRESSLINE>
                      </xsl:for-each>
                      <POST_CODE>    <xsl:value-of select="INVOICE_HEAD/INVOICE_PARTIES/PAYEE/ADDRESS/POST_CODE"/></POST_CODE>
                      <CITY>         <xsl:value-of select="INVOICE_HEAD/INVOICE_PARTIES/PAYEE/ADDRESS/CITY"/></CITY>
                      <STATE_CODE>   <xsl:value-of select="INVOICE_HEAD/INVOICE_PARTIES/PAYEE/ADDRESS/STATE_CODE"/></STATE_CODE>
                      <COUNTRY_CODE> <xsl:value-of select="INVOICE_HEAD/INVOICE_PARTIES/PAYEE/ADDRESS/COUNTRY_CODE"/></COUNTRY_CODE>
                      <COUNTRY>      <xsl:value-of select="INVOICE_HEAD/INVOICE_PARTIES/PAYEE/ADDRESS/COUNTRY"/></COUNTRY>
                  </ADDRESS>
               </PAYEE>
               <INVOICEE>
               <xsl:variable name="invoicee" select="$inv_parties/INVOICEE" />
                   <BILLING_LEVEL><xsl:value-of select="$invoicee/BILLING_LEVEL"/></BILLING_LEVEL>
                   <PARTYCODE>    <xsl:value-of select="$invoicee/PARTYCODE"/></PARTYCODE>
                   <ADDRESS>
                   <xsl:variable name="address" select="$invoicee/ADDRESS" />
                      <xsl:for-each select="$address/ADDRESSLINE">
                          <ADDRESSLINE>  <xsl:value-of select="."/></ADDRESSLINE>
                      </xsl:for-each>
                      <POST_CODE>    <xsl:value-of select="$address/POST_CODE"/></POST_CODE>
                      <CITY>         <xsl:value-of select="$address/CITY"/></CITY>
                      <STATE_CODE>   <xsl:value-of select="$address/STATE_CODE"/></STATE_CODE>
                      <COUNTRY_CODE> <xsl:value-of select="$address/COUNTRY_CODE"/></COUNTRY_CODE>
                      <COUNTRY>      <xsl:value-of select="$address/COUNTRY"/></COUNTRY>
                   </ADDRESS>
              </INVOICEE>
              </INV_PARTIES>
              <INV_QUALIFIER><xsl:value-of select="$head/INVOICE_QUALIFIER"/></INV_QUALIFIER>

            </HEAD>


            <DETAILS>
            <xsl:for-each select="INVOICE_DETAILS/INVOICE_DETAIL">
              <xsl:variable name="inv_detail" select="." />

            <INV_DETAIL>
              <A_LINE><xsl:value-of select="$inv_detail/@LINE"/></A_LINE>
              <A_TYP> <xsl:value-of select="$inv_detail/@TYP" /></A_TYP>
              <CUSTOMER>
                <xsl:variable name="customer" select="$inv_detail/CUSTOMER" />
                <CARDNUMBER>  <xsl:value-of select="$customer/CARDNUMBER"/></CARDNUMBER>
                <NAME>        <xsl:value-of select="$customer/NAME"/></NAME>
              </CUSTOMER>
              <SERVICE_PROV>
                <xsl:variable name="service_prov" select="$inv_detail/SERVICE_PROVIDER" />
                <CODE>        <xsl:value-of select="$service_prov/CODE"/></CODE>
                <COMPANYNAME> <xsl:value-of select="$service_prov/COMPANYCODE"/></COMPANYNAME>
                <STREET>      <xsl:value-of select="$service_prov/STREET"/></STREET>
                <PLACE>       <xsl:value-of select="$service_prov/PLACE"/></PLACE>
                <TAX_CODE>    <xsl:value-of select="$service_prov/TAX_CODE"/></TAX_CODE>
              </SERVICE_PROV>
              <CUSTOMER_DAT>
                <xsl:variable name="customer_dat" select="$inv_detail/CUSTOMER_DATA" />
                <PERSONAL_ID>    <xsl:value-of select="$customer_dat/PERSONAL_ID"/></PERSONAL_ID>
                <DEP_CODE>       <xsl:value-of select="$customer_dat/DEPARTMENT_CODE"/></DEP_CODE>
                <COST_CENTER>    <xsl:value-of select="$customer_dat/COST_CENTER"/></COST_CENTER>
                <ACC_UNIT>       <xsl:value-of select="$customer_dat/ACCOUNTING_UNIT"/></ACC_UNIT>
                <ACC_NUMBER>     <xsl:value-of select="$customer_dat/ACCOUNT_NUMBER"/></ACC_NUMBER>
                <FILE_DATE>      <xsl:value-of select="$customer_dat/FILE_DATE"/></FILE_DATE>
                <PROJ_NUMBER>    <xsl:value-of select="$customer_dat/PROJECT_NUMBER"/></PROJ_NUMBER>
                <ORDER_NUMBER>   <xsl:value-of select="$customer_dat/ORDER_NUMBER"/></ORDER_NUMBER>
                <ACTION_CODE>    <xsl:value-of select="$customer_dat/ACTION_CODE"/></ACTION_CODE>
                <DESTINATION>    <xsl:value-of select="$customer_dat/DESTINATION"/></DESTINATION>
                <TXN_REF>        <xsl:value-of select="$customer_dat/TXN_REF"/></TXN_REF>
                <CUST_REF>       <xsl:value-of select="$customer_dat/CUSTOMER_REF"/></CUST_REF>
                <DOM_TAG>        <xsl:value-of select="$customer_dat/DOM_TAG"/></DOM_TAG>
              </CUSTOMER_DAT>

              <SALES_DATE>  <xsl:value-of select="$inv_detail/SALES_DATE"/></SALES_DATE>
              <PROCE_DATE>  <xsl:value-of select="$inv_detail/PROCESSING_DATE"/></PROCE_DATE>
              <ONL_ORD_REF> <xsl:value-of select="$inv_detail/ONLINE_ORDER_REF"/></ONL_ORD_REF>

              <SALE_VALUES>
                <xsl:variable name="sale_values" select="$inv_detail/SALE_VALUES" />
                <A_SALE_TO_BASE_RATE><xsl:value-of select="$sale_values/@SALE_TO_BASE_RATE" /></A_SALE_TO_BASE_RATE>
                <CURRENCY>    <xsl:value-of select="$sale_values/CURRENCY"/></CURRENCY>
                <NET_VALUE>   <xsl:value-of select="$sale_values/NET_VALUE"/></NET_VALUE>
                <VAT_VALUE>   <xsl:value-of select="$sale_values/VAT_VALUE"/></VAT_VALUE>
                <GROSS_VALUE> <xsl:value-of select="$sale_values/GROSS_VALUE"/></GROSS_VALUE>
                <ADD_INS_VAL> <xsl:value-of select="$sale_values/ADDITIONAL_INSURANCE_VALUE"/></ADD_INS_VAL>
                <LINE_GROSS_VAL><xsl:value-of select="$sale_values/LINE_GROSS_VALUE"/></LINE_GROSS_VAL>
<xsl:variable name="vat_sum" select="$sale_values/VAT_SUMMARY" />
                <xsl:for-each select="$sale_values/VAT_SUMMARY">

                <VAT_SUM>


                  <A_RATE>    <xsl:value-of select="$vat_sum/@RATE" />    </A_RATE>

                  <VAT_VALUE> <xsl:value-of select="$vat_sum/VAT_VALUE"/> </VAT_VALUE>
                  <NET_VALUE> <xsl:value-of select="$vat_sum/NET_VALUE"/> </NET_VALUE>

                </VAT_SUM></xsl:for-each>
              </SALE_VALUES>

              <BILL_VALUES>
                <xsl:variable name="bill_values" select="$inv_detail/BILLING_VALUES" />
                <CURRENCY>      <xsl:value-of select="$bill_values/CURRENCY"/></CURRENCY>
                <NET_VALUE>     <xsl:value-of select="$bill_values/NET_VALUE"/></NET_VALUE>
                <VAT_VALUE>     <xsl:value-of select="$bill_values/VAT_VALUE"/></VAT_VALUE>
                <GROSS_VALUE>   <xsl:value-of select="$bill_values/GROSS_VALUE"/></GROSS_VALUE>
                <ADD_INS_VAL>   <xsl:value-of select="$bill_values/ADDITIONAL_INSURANCE_VALUE"/></ADD_INS_VAL>
                <LINE_GROSS_VAL><xsl:value-of select="$bill_values/LINE_GROSS_VALUE"/></LINE_GROSS_VAL>

                <xsl:for-each select="$bill_values/VAT_SUMMARY">
                <xsl:variable name="vat_sum" select="$bill_values/VAT_SUMMARY" />
                <VAT_SUM>

                  <A_RATE>    <xsl:value-of select="$vat_sum/@RATE" />    </A_RATE>
                  <VAT_VALUE> <xsl:value-of select="$vat_sum/VAT_VALUE"/> </VAT_VALUE>
                  <NET_VALUE> <xsl:value-of select="$vat_sum/NET_VALUE"/> </NET_VALUE>

                </VAT_SUM></xsl:for-each>

              </BILL_VALUES>


              <DET_DESCRIP>
              <xsl:for-each select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION">
              <DETAIL_DESC>
                <A_LINE><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/@LINE" /></A_LINE>
                <SALES_PROV>
                  <AGENCY>    <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALES_PROVIDER/AGENCY"/></AGENCY>
                  <BRANCH>    <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALES_PROVIDER/BRANCH"/></BRANCH>
                </SALES_PROV>
                <SALE_VAL>
                    <A_SALE_TO_BASE_RATE><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALE_VALUES/@SALE_TO_BASE_RATE" /></A_SALE_TO_BASE_RATE>
                    <CURRENCY>    <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALE_VALUES/CURRENCY"/></CURRENCY>
                    <NET_VALUE>   <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALE_VALUES/NET_VALUE"/></NET_VALUE>
                    <VAT_VALUE>   <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALE_VALUES/VAT_VALUE"/></VAT_VALUE>
                    <GROSS_VALUE> <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALE_VALUES/GROSS_VALUE"/></GROSS_VALUE>
                    <ADD_INS_VAL> <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALE_VALUES/ADDITIONAL_INSURANCE_VALUE"/></ADD_INS_VAL>
                    <LINE_GROSS_VAL><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALE_VALUES/LINE_GROSS_VALUE"/></LINE_GROSS_VAL>
                    <VAT_SUM>

                        <xsl:for-each select="">
                          <VAT_VALUE><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALE_VALUES/VAT_SUMMARY/VAT_VALUE"/></VAT_VALUE>
                        </xsl:for-each>
                        <xsl:for-each select="">
                          <NET_VALUE><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SALE_VALUES/VAT_SUMMARY/NET_VALUE"/></NET_VALUE>
                        </xsl:for-each>
                    </VAT_SUM>
                </SALE_VAL>
                <BILL_VAL>
                    <CURRENCY>    <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/BILLING_VALUES/CURRENCY"/></CURRENCY>
                    <NET_VALUE>   <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/BILLING_VALUES/NET_VALUE"/></NET_VALUE>
                    <VAT_VALUE>   <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/BILLING_VALUES/VAT_VALUE"/></VAT_VALUE>
                    <GROSS_VALUE> <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/BILLING_VALUES/GROSS_VALUE"/></GROSS_VALUE>
                    <ADD_INS_VAL> <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/BILLING_VALUES/ADDITIONAL_INSURANCE_VALUE"/></ADD_INS_VAL>
                    <LINE_GROSS_VAL><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/BILLING_VALUES/LINE_GROSS_VALUE"/></LINE_GROSS_VAL>
                    <VAT_SUM>
                        <A_RATE><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/BILLING_VALUES/VAT_SUMMARY/@RATE" /></A_RATE>
                        <xsl:for-each select="">
                          <VAT_VALUE><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/BILLING_VALUES/VAT_SUMMARY/VAT_VALUE"/></VAT_VALUE>
                        </xsl:for-each>
                        <xsl:for-each select="">
                          <NET_VALUE><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/BILLING_VALUES/VAT_SUMMARY/NET_VALUE"/></NET_VALUE>
                        </xsl:for-each>
                    </VAT_SUM>

                </BILL_VAL>
                <SERV_DESC>
                    <DATE>           <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/DATE"/></DATE>
                    <DOC_NUMBER>     <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/DOCUMENT_NUMBER"/></DOC_NUMBER>
                    <VOUCHER_NUMBER> <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/VOUCHER_NUMBER"/></VOUCHER_NUMBER>
                    <CC_CODE>        <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/CC_CODE"/></CC_CODE>
                    <CLASS>          <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/CLASS"/></CLASS>
                    <TXN_TYPE_DETAIL><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/TXN_TYPE_DETAIL"/></TXN_TYPE_DETAIL>
                    <ETIX_QUAL>      <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/ETIX_QUALIFIER"/></ETIX_QUAL>
                    <FLIGHT_TAX>     <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/FLIGHT_TAX"/></FLIGHT_TAX>
                    <A_ADD_INFO_LINE><xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/ADDITIONAL_INFO/@LINE"/></A_ADD_INFO_LINE>
                    <xsl:for-each select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/ADDITIONAL_INFO">
                        <ADD_INFO>   <xsl:value-of select="."/></ADD_INFO>
                    </xsl:for-each>
                    <DB_TRAVEL_DATA>
                        <START_STATION>  <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/DB_TRAVEL_DATA/START_STATION"/></START_STATION>
                        <DEST_STATION>   <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/DB_TRAVEL_DATA/DEST_STATION"/></DEST_STATION>
                        <DB_CLASS>       <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/DB_TRAVEL_DATA/DB_CLASS"/></DB_CLASS>
                        <ADULTS>         <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/DB_TRAVEL_DATA/ADULTS"/></ADULTS>
                        <CHILDREN>       <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/DB_TRAVEL_DATA/CHILDREN"/></CHILDREN>

                    </DB_TRAVEL_DATA>
                    <HT_BOOK_DATA>
                        <START_DATE>  <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/HT_BOOKING_DATA/START_DATE"/></START_DATE>
                        <END_DATE>    <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/HT_BOOKING_DATA/END_DATE"/></END_DATE>
                        <AMOUNT>      <xsl:value-of select="INVOICE_DETAILS/INVOICE_DETAIL/DETAIL_DESCRIPTIONS/DETAIL_DESCRIPTION/SERVICE_DESCRIPTION/HT_BOOKING_DATA/AMOUNT"/></AMOUNT>
                    </HT_BOOK_DATA>

                </SERV_DESC>
               </DETAIL_DESC>
               </xsl:for-each>
              </DET_DESCRIP>
            </INV_DETAIL>
            </xsl:for-each>
            </DETAILS>


<!--
NUMBER_OF_INVOICE_DETAIL
<xsl:for-each select="INVOICE_SUMMARY/TOTAL_SALE_VALUES/VAT_SUMMARY">
</xsl:for-each>
<xsl:for-each select="INVOICE_SUMMARY/TOTAL_BILLING_VALUES/VAT_SUMMARY">
<xsl:attribute name="NUMBER_OF_INVOICE_DETAIL" >
</xsl:attribute>
<xsl:attribute name="RATE" ></xsl:attribute>
-->

            <SUMMARY>
            <xsl:variable name="summary" select="INVOICE_SUMMARY" />
                <A_NUM_INV_DET><xsl:value-of select="$summary/@NUMBER_OF_INVOICE_DETAIL" /></A_NUM_INV_DET>

                <xsl:for-each select="$summary/TOTAL_SALE_VALUES">
                <TOTAL_SALE_VALUES>
                <xsl:variable name="total_sale_values" select="$summary" />
                    <A_CURRENCY><xsl:value-of select="$total_sale_values/@CURRENCY"/></A_CURRENCY>
                    <NET_TOTAL> <xsl:value-of select="$total_sale_values/NET_TOTAL"/></NET_TOTAL>
                    <VAT_TOTAL> <xsl:value-of select="$total_sale_values/VAT_TOTAL"/></VAT_TOTAL>

                    <xsl:for-each select="INVOICE_SUMMARY/TOTAL_SALE_VALUES/VAT_SUMMARY">
                    <VAT_SUM>
                    <xsl:variable name="vat_sum" select="$total_sale_values/VAT_SUMMARY" />
                      <A_RATE><xsl:value-of select="$vat_sum/@RATE" /></A_RATE>
                      <NET_VALUE><xsl:value-of select="."/></NET_VALUE>
                      <VAT_VALUE><xsl:value-of select="."/></VAT_VALUE>
                    </VAT_SUM></xsl:for-each>

                </TOTAL_SALE_VALUES>
                </xsl:for-each>


                <TOTAL_BILL_VALUES>
                    <NET_TOTAL> <xsl:value-of select="INVOICE_SUMMARY/TOTAL_BILLING_VALUES/NET_TOTAL"/></NET_TOTAL>
                    <VAT_TOTAL> <xsl:value-of select="INVOICE_SUMMARY/TOTAL_BILLING_VALUES/VAT_TOTAL"/></VAT_TOTAL>

                    <VAT_SUM>
                        <A_RATE><xsl:value-of select="INVOICE_SUMMARY/TOTAL_BILLING_VALUES/VAT_SUMMARY/@RATE" /></A_RATE>

                        <xsl:for-each select="INVOICE_SUMMARY/TOTAL_BILLING_VALUES/VAT_SUMMARY/NET_VALUE">
                          <NET_VALUE><xsl:value-of select="."/></NET_VALUE>
                        </xsl:for-each>
                        <xsl:for-each select="INVOICE_SUMMARY/TOTAL_BILLING_VALUES/VAT_SUMMARY/VAT_VALUE">
                          <VAT_VALUE><xsl:value-of select="."/></VAT_VALUE>
                        </xsl:for-each>
                    </VAT_SUM>

                    <ADD_INS_VAL>        <xsl:value-of select="INVOICE_SUMMARY/TOTAL_BILLING_VALUES/ADDITIONAL_INSURANCE_TOTAL"/></ADD_INS_VAL>
                    <TOTAL_BILL_AMOUNT>  <xsl:value-of select="INVOICE_SUMMARY/TOTAL_BILLING_VALUES/TOTAL_BILLING_AMOUNT"/></TOTAL_BILL_AMOUNT>
                </TOTAL_BILL_VALUES>
            </SUMMARY>



            </INVOICE_BTM>
          </xsl:for-each>
        </XML_OUTPUT>
      </asx:values>
    </asx:abap>
  </xsl:template>
</xsl:transform>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования -> Conversion All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.