Solved

Adding Namespace to the second node of the xml

Posted on 2016-11-10
16
33 Views
Last Modified: 2016-11-11
Hi Folks,

I have the following xml I need to add prefix and the Namespace to the second node as below using xslt 1.0

Input xml

<Request>
  <Info>
    <Country>US</Country>
    <Part>A</Part>
   </Info>
</Request>

Output xml

<Request>
  <xy:Info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://hgkl.kj.com">>
    <Country>US</Country>
    <Part>A</Part>
  </Info>
</Request>
0
Comment
Question by:kalyangkm
  • 10
  • 6
16 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 41882844
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    
    <xsl:template match="*">
        <xsl:element name="{local-name()}" namespace="http://hgkl.kj.com">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>
    
    <xsl:template match="Request">
        <xsl:element name="{local-name()}">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>

    <xsl:template match="Info">
        <xy:Info
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://hgkl.kj.com"            
            xmlns:xy="http://hgkl.kj.com"            
            >
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xy:Info>
    </xsl:template>

</xsl:stylesheet>

Open in new window

0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 41882848
Note: The example XML you posted has an issue, it does not bind the xy: prefix to namespace, so it is not wellformed and can not be created just like that in XSLT... at all, XSLT does not allow creation of XML that is not wellformed (unless you go hacking your way with creating text instead of XML

Let's simply assume that I can add a prefix binding (you will find that one in the result XML) and drop the second > which I consider a typo

Also note that because of the xmlns without prefix, I had to put all the children of the second node in that namespace
but I guess that is exactly what you want
0
 

Author Comment

by:kalyangkm
ID: 41882869
Geert,

Ok, Please correct the syntax as it is saying it is unparasble

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
   
    <xsl:template match="*">
        <xsl:element name="{local-name()}" namespace="http://hgkl.kj.com">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>
   
    <xsl:template match="Request">
        <xsl:element name="{local-name()}">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>

    <xsl:template match="Info">
        <Info
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://hgkl.kj.com">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </Info>
    </xsl:template>
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 41882887
"Ok, Please correct the syntax as it is saying it is unparasble"

1. Please be more specific
2. Do some on site research yourself

Before I posted my code I have tested the XSLT1 in 4 different XSLT1 processors
I have used only standard XSLT1.0 constructs, meaning this will work in any compliant XSLT1 processor
So you need to make sure that you copy and pasted all correctly, after that you tell me about the execution environment and after that you give me the details of the error messages
because I can not reproduce "unparsable"
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 41882890
Oh, If you simply just copy / pasted my code in your comment... please note that you missed the closing xsl:stylesheet tag
0
 

Author Comment

by:kalyangkm
ID: 41882892
Sorry, to be more specific, this is what I am getting

Unable to display tree view; Error when parsing an XML document (XML document structures must start and end within the same entity.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 41882893
I think you forgot to copy the

</xsl:stylesheet>

at the end
0
 

Author Comment

by:kalyangkm
ID: 41882909
You are right. But now apart from adding the name spaces  to the second field it is also adding xmlns:ns1253="http://hgkl.kj.com" to all the namespaces.

I was wondering the issue is with this line of the code

        <xsl:element name="{local-name()}" namespace="http://hgkl.kj.com">
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 60

Expert Comment

by:Geert Bormans
ID: 41882935
That is an issue with your serialisation
It is possible that that can not be controlled

by having this  xmlns="http://hgkl.kj.com"
in the second node, by default all descendants without a prefix are in that namespace

<Country>US</Country>
in that context is equivalent to
<Country xmlns="http://hgkl.kj.com">US</Country>
by definition, that is 100% equivalent to
<ns1253:Country xmlns:ns1253="http://hgkl.kj.com">US</ns1253:Country>

Both are equivalent, however the first format is nicer to read
Since they are equivalent, you usually can not control how the serializer spits it out
so maybe you need to live with that, it does not matter for the next steps in the process (unless you are creating XML for human consumption)

If you give more details about the process, I might know a way to fool the serializer
0
 

Author Comment

by:kalyangkm
ID: 41883017
Hi Geert,

Thanks for your help so far. Actually I am able to remove the unwanted tags in all the nodes and almost there in getting the desired output. But I just have one issue. I am not able to retain the root node as it is as <ns0:MT_EBILLING_TRC xmlns:ns0="urn:com.sales">. No matter what I do it is just showing up as <MT_EBILLING_TRC >. Please let me know if you have any thoughts on getting the root node as it is as the source.

Sorry that I ddint share my actual xml earlier. Here it is

<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_EBILLING_TRC xmlns:ns0="urn:com.sales">
   <Facturae>
      <FileHeader>
         <SchemaVersion/>
         <Modality/>
         <InvoiceIssuerType/>
         <ThirdParty>
            <TaxIdentification>
               <PersonTypeCode/>
               <ResidenceTypeCode/>
               <TaxIdentificationNumber/>
            </TaxIdentification>
            <LegalEntity>
               <CorporateName/>
               <TradeName/>
               <RegistrationData>
                  <Book/>
                  <RegisterOfCompaniedLocation/>
                  <Sheet/>
                  <Folio/>
                  <Section/>
                  <Volume/>
                  <AdditionalRegistrationData/>
               </RegistrationData>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </LegalEntity>
            <Individual>
               <Name/>
               <FirstSurname/>
               <SecondSurname/>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </Individual>
         </ThirdParty>
         <Batch>
            <BatchIdentifier/>
            <InvoicesCount/>
            <TotalInvoicesAmount>
               <TotalAmount/>
               <EquivalentInEuros/>
            </TotalInvoicesAmount>
            <TotalOutstandingAmount>
               <TotalAmount/>
               <EquivalentInEuros/>
            </TotalOutstandingAmount>
            <TotalExecutableAmount>
               <TotalAmount/>
               <EquivalentInEuros/>
            </TotalExecutableAmount>
            <InvoiceCurrencyCode/>
         </Batch>
         <FactoringAssignmentData>
            <Assignee>
               <TaxIdentification>
                  <PersonTypeCode/>
                  <ResidenceTypeCode/>
                  <TaxIdentificationNumber/>
               </TaxIdentification>
               <LegalEntity>
                  <CorporateName/>
                  <TradeName/>
                  <RegistrationData>
                     <Book/>
                     <RegisterOfCompaniedLocation/>
                     <Sheet/>
                     <Folio/>
                     <Section/>
                     <Volume/>
                     <AdditionalRegistrationData/>
                  </RegistrationData>
                  <AddressInSpain>
                     <Address/>
                     <PostCode/>
                     <Town/>
                     <Province/>
                     <CountryCode/>
                  </AddressInSpain>
                  <OverseasAddress>
                     <Address/>
                     <PostCodeAndTown/>
                     <Province/>
                     <CountryCode/>
                  </OverseasAddress>
                  <ContactDetails>
                     <Telephone/>
                     <TeleFax/>
                     <WebAddress/>
                     <ElectronicMail/>
                     <ContactPersons/>
                     <CnoCnae/>
                     <INETownCode/>
                     <AdditionalContactDetails/>
                  </ContactDetails>
               </LegalEntity>
               <Individual>
                  <Name/>
                  <FirstSurname/>
                  <SecondSurname/>
                  <AddressInSpain>
                     <Address/>
                     <PostCode/>
                     <Town/>
                     <Province/>
                     <CountryCode/>
                  </AddressInSpain>
                  <OverseasAddress>
                     <Address/>
                     <PostCodeAndTown/>
                     <Province/>
                     <CountryCode/>
                  </OverseasAddress>
                  <ContactDetails>
                     <Telephone/>
                     <TeleFax/>
                     <WebAddress/>
                     <ElectronicMail/>
                     <ContactPersons/>
                     <CnoCnae/>
                     <INETownCode/>
                     <AdditionalContactDetails/>
                  </ContactDetails>
               </Individual>
            </Assignee>
            <PaymentDetails>
               <Installment>
                  <InstallmentDueDate/>
                  <InstallmentAmount/>
                  <PaymentMeans/>
                  <AccountToBeCredited>
                     <IBAN/>
                     <AccountNumber/>
                     <BankCode/>
                     <BranchCode/>
                     <BranchInSpainAddress>
                        <Address/>
                        <PostCode/>
                        <Town/>
                        <Province/>
                        <CountryCode/>
                     </BranchInSpainAddress>
                     <OverseasBranchAddress>
                        <Address/>
                        <PostCodeAndTown/>
                        <Province/>
                        <CountryCode/>
                     </OverseasBranchAddress>
                     <BIC/>
                  </AccountToBeCredited>
                  <PaymentReconciliationReference/>
                  <AccountToBeDebited>
                     <IBAN/>
                     <AccountNumber/>
                     <BankCode/>
                     <BranchCode/>
                     <BranchInSpainAddress>
                        <Address/>
                        <PostCode/>
                        <Town/>
                        <Province/>
                        <CountryCode/>
                     </BranchInSpainAddress>
                     <OverseasBranchAddress>
                        <Address/>
                        <PostCodeAndTown/>
                        <Province/>
                        <CountryCode/>
                     </OverseasBranchAddress>
                     <BIC/>
                  </AccountToBeDebited>
                  <CollectionAdditionalInformation/>
                  <RegulatoryReportingData/>
                  <DebitReconciliationReference/>
               </Installment>
            </PaymentDetails>
            <FactoringAssignmentClauses/>
         </FactoringAssignmentData>
      </FileHeader>
      <Parties>
         <SellerParty>
            <TaxIdentification>
               <PersonTypeCode/>
               <ResidenceTypeCode/>
               <TaxIdentificationNumber/>
            </TaxIdentification>
            <PartyIdentification/>
            <AdministrativeCentres>
               <AdministrativeCentre>
                  <CentreCode/>
                  <RoleTypeCode/>
                  <Name/>
                  <FirstSurname/>
                  <SecondSurname/>
                  <AddressInSpain>
                     <Address/>
                     <PostCode/>
                     <Town/>
                     <Province/>
                     <CountryCode/>
                  </AddressInSpain>
                  <OverseasAddress>
                     <Address/>
                     <PostCodeAndTown/>
                     <Province/>
                     <CountryCode/>
                  </OverseasAddress>
                  <ContactDetails>
                     <Telephone/>
                     <TeleFax/>
                     <WebAddress/>
                     <ElectronicMail/>
                     <ContactPersons/>
                     <CnoCnae/>
                     <INETownCode/>
                     <AdditionalContactDetails/>
                  </ContactDetails>
                  <PhysicalGLN/>
                  <LogicalOperationalPoint/>
                  <CentreDescription/>
               </AdministrativeCentre>
            </AdministrativeCentres>
            <LegalEntity>
               <CorporateName/>
               <TradeName/>
               <RegistrationData>
                  <Book/>
                  <RegisterOfCompaniedLocation/>
                  <Sheet/>
                  <Folio/>
                  <Section/>
                  <Volume/>
                  <AdditionalRegistrationData/>
               </RegistrationData>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </LegalEntity>
            <Individual>
               <Name/>
               <FirstSurname/>
               <SecondSurname/>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </Individual>
         </SellerParty>
         <BuyerParty>
            <TaxIdentification>
               <PersonTypeCode/>
               <ResidenceTypeCode/>
               <TaxIdentificationNumber/>
            </TaxIdentification>
            <PartyIdentification/>
            <AdministrativeCentres>
               <AdministrativeCentre>
                  <CentreCode/>
                  <RoleTypeCode/>
                  <Name/>
                  <FirstSurname/>
                  <SecondSurname/>
                  <AddressInSpain>
                     <Address/>
                     <PostCode/>
                     <Town/>
                     <Province/>
                     <CountryCode/>
                  </AddressInSpain>
                  <OverseasAddress>
                     <Address/>
                     <PostCodeAndTown/>
                     <Province/>
                     <CountryCode/>
                  </OverseasAddress>
                  <ContactDetails>
                     <Telephone/>
                     <TeleFax/>
                     <WebAddress/>
                     <ElectronicMail/>
                     <ContactPersons/>
                     <CnoCnae/>
                     <INETownCode/>
                     <AdditionalContactDetails/>
                  </ContactDetails>
                  <PhysicalGLN/>
                  <LogicalOperationalPoint/>
                  <CentreDescription/>
               </AdministrativeCentre>
            </AdministrativeCentres>
            <LegalEntity>
               <CorporateName/>
               <TradeName/>
               <RegistrationData>
                  <Book/>
                  <RegisterOfCompaniedLocation/>
                  <Sheet/>
                  <Folio/>
                  <Section/>
                  <Volume/>
                  <AdditionalRegistrationData/>
               </RegistrationData>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </LegalEntity>
            <Individual>
               <Name/>
               <FirstSurname/>
               <SecondSurname/>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </Individual>
         </BuyerParty>
      </Parties>
      <Invoices>
         <Invoice>
            <InvoiceHeader>
               <InvoiceNumber/>
               <InvoiceSeriesCode/>
               <InvoiceDocumentType/>
               <InvoiceClass/>
               <Corrective>
                  <InvoiceNumber/>
                  <InvoiceSeriesCode/>
                  <ReasonCode/>
                  <ReasonDescription/>
                  <TaxPeriod>
                     <StartDate/>
                     <EndDate/>
                  </TaxPeriod>
                  <CorrectionMethod/>
                  <CorrectionMethodDescription/>
                  <AdditionalReasonDescription/>
               </Corrective>
            </InvoiceHeader>
            <InvoiceIssueData>
               <IssueDate/>
               <OperationDate/>
               <PlaceOfIssue>
                  <PostCode/>
                  <PlaceOfIssueDescription/>
               </PlaceOfIssue>
               <InvoicingPeriod>
                  <StartDate/>
                  <EndDate/>
               </InvoicingPeriod>
               <InvoiceCurrencyCode/>
               <ExchangeRateDetails>
                  <ExchangeRate/>
                  <ExchangeRateDate/>
               </ExchangeRateDetails>
               <TaxCurrencyCode/>
               <LanguageName/>
            </InvoiceIssueData>
            <TaxesOutputs>
               <Tax>
                  <TaxTypeCode/>
                  <TaxRate/>
                  <TaxableBase>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </TaxableBase>
                  <TaxAmount>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </TaxAmount>
                  <SpecialTaxableBase>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </SpecialTaxableBase>
                  <SpecialTaxAmount>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </SpecialTaxAmount>
                  <EquivalenceSurcharge/>
                  <EquivalenceSurchargeAmount>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </EquivalenceSurchargeAmount>
               </Tax>
            </TaxesOutputs>
            <TaxesWithheld>
               <Tax>
                  <TaxTypeCode/>
                  <TaxRate/>
                  <TaxableBase>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </TaxableBase>
                  <TaxAmount>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </TaxAmount>
               </Tax>
            </TaxesWithheld>
            <InvoiceTotals>
               <TotalGrossAmount/>
               <GeneralDiscounts>
                  <Discount>
                     <DiscountReason/>
                     <DiscountRate/>
                     <DiscountAmount/>
                  </Discount>
               </GeneralDiscounts>
               <GeneralSurcharges>
                  <Charge>
                     <ChargeReason/>
                     <ChargeRate/>
                     <ChargeAmount/>
                  </Charge>
               </GeneralSurcharges>
               <TotalGeneralDiscounts/>
               <TotalGeneralSurcharges/>
               <TotalGrossAmountBeforeTaxes/>
               <TotalTaxOutputs/>
               <TotalTaxesWithheld/>
               <InvoiceTotal/>
               <Subsidies>
                  <Subsidy>
                     <SubsidyDescription/>
                     <SubsidyRate/>
                     <SubsidyAmount/>
                  </Subsidy>
               </Subsidies>
               <PaymentsOnAccount>
                  <PaymentOnAccount>
                     <PaymentOnAccountDate/>
                     <PaymentOnAccountAmount/>
                  </PaymentOnAccount>
               </PaymentsOnAccount>
               <ReimbursableExpenses>
                  <ReimbursableExpenses>
                     <ReimbursableExpensesSellerParty>
                        <PersonTypeCode/>
                        <ResidenceTypeCode/>
                        <TaxIdentificationNumber/>
                     </ReimbursableExpensesSellerParty>
                     <ReimbursableExpensesBuyerParty>
                        <PersonTypeCode/>
                        <ResidenceTypeCode/>
                        <TaxIdentificationNumber/>
                     </ReimbursableExpensesBuyerParty>
                     <IssueDate/>
                     <InvoiceNumber/>
                     <InvoiceSeriesCode/>
                     <ReimbursableExpensesAmount/>
                  </ReimbursableExpenses>
               </ReimbursableExpenses>
               <TotalFinancialExpenses/>
               <TotalOutstandingAmount/>
               <TotalPaymentsOnAccount/>
               <AmountsWithheld>
                  <WithholdingReason/>
                  <WithholdingRate/>
                  <WithholdingAmount/>
               </AmountsWithheld>
               <TotalExecutableAmount/>
               <TotalReimbursableExpenses/>
            </InvoiceTotals>
            <Items>
               <InvoiceLine>
                  <IssuerContractReference/>
                  <IssuerContractDate/>
                  <IssuerTransactionReference/>
                  <IssuerTransactionDate/>
                  <ReceiverContractReference/>
                  <ReceiverContractDate/>
                  <ReceiverTransactionReference/>
                  <ReceiverTransactionDate/>
                  <FileReference/>
                  <FileDate/>
                  <SequenceNumber/>
                  <DeliveryNotesReferences>
                     <DeliveryNote>
                        <DeliveryNoteNumber/>
                        <DeliveryNoteDate/>
                     </DeliveryNote>
                  </DeliveryNotesReferences>
                  <ItemDescription/>
                  <Quantity/>
                  <UnitOfMeasure/>
                  <UnitPriceWithoutTax/>
                  <TotalCost/>
                  <DiscountsAndRebates>
                     <Discount>
                        <DiscountReason/>
                        <DiscountRate/>
                        <DiscountAmount/>
                     </Discount>
                  </DiscountsAndRebates>
                  <Charges>
                     <Charge>
                        <ChargeReason/>
                        <ChargeRate/>
                        <ChargeAmount/>
                     </Charge>
                  </Charges>
                  <GrossAmount/>
                  <TaxesWithheld>
                     <Tax>
                        <TaxTypeCode/>
                        <TaxRate/>
                        <TaxableBase>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </TaxableBase>
                        <TaxAmount>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </TaxAmount>
                     </Tax>
                  </TaxesWithheld>
                  <TaxesOutputs>
                     <Tax>
                        <TaxTypeCode/>
                        <TaxRate/>
                        <TaxableBase>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </TaxableBase>
                        <TaxAmount>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </TaxAmount>
                        <SpecialTaxableBase>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </SpecialTaxableBase>
                        <SpecialTaxAmount>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </SpecialTaxAmount>
                        <EquivalenceSurcharge/>
                        <EquivalenceSurchargeAmount>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </EquivalenceSurchargeAmount>
                     </Tax>
                  </TaxesOutputs>
                  <LineItemPeriod>
                     <StartDate/>
                     <EndDate/>
                  </LineItemPeriod>
                  <TransactionDate/>
                  <AdditionalLineItemInformation/>
                  <SpecialTaxableEvent>
                     <SpecialTaxableEventCode/>
                     <SpecialTaxableEventReason/>
                  </SpecialTaxableEvent>
                  <ArticleCode/>
                  <Extensions/>
               </InvoiceLine>
            </Items>
            <PaymentDetails>
               <Installment>
                  <InstallmentDueDate/>
                  <InstallmentAmount/>
                  <PaymentMeans/>
                  <AccountToBeCredited>
                     <IBAN/>
                     <AccountNumber/>
                     <BankCode/>
                     <BranchCode/>
                     <BranchInSpainAddress>
                        <Address/>
                        <PostCode/>
                        <Town/>
                        <Province/>
                        <CountryCode/>
                     </BranchInSpainAddress>
                     <OverseasBranchAddress>
                        <Address/>
                        <PostCodeAndTown/>
                        <Province/>
                        <CountryCode/>
                     </OverseasBranchAddress>
                     <BIC/>
                  </AccountToBeCredited>
                  <PaymentReconciliationReference/>
                  <AccountToBeDebited>
                     <IBAN/>
                     <AccountNumber/>
                     <BankCode/>
                     <BranchCode/>
                     <BranchInSpainAddress>
                        <Address/>
                        <PostCode/>
                        <Town/>
                        <Province/>
                        <CountryCode/>
                     </BranchInSpainAddress>
                     <OverseasBranchAddress>
                        <Address/>
                        <PostCodeAndTown/>
                        <Province/>
                        <CountryCode/>
                     </OverseasBranchAddress>
                     <BIC/>
                  </AccountToBeDebited>
                  <CollectionAdditionalInformation/>
                  <RegulatoryReportingData/>
                  <DebitReconciliationReference/>
               </Installment>
            </PaymentDetails>
            <LegalLiterals>
               <LegalReference/>
            </LegalLiterals>
            <AdditionalData>
               <RelatedInvoice/>
               <RelatedDocuments>
                  <Attachment>
                     <AttachmentCompressionAlgorithm/>
                     <AttachmentFormat/>
                     <AttachmentEncoding/>
                     <AttachmentDescription/>
                     <AttachmentData/>
                  </Attachment>
               </RelatedDocuments>
               <InvoiceAdditionalInformation/>
               <Extensions/>
            </AdditionalData>
         </Invoice>
      </Invoices>
      <Extensions/>
   </Facturae>
</ns0:MT_EBILLING_TRC>

Open in new window




Here is the XSLT

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:template match="*">
        <xsl:element name="{local-name()}">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>
    
    <xsl:template match="MT_EBILLING_TRC">
        <xsl:element name="ns0:{name()}" xmlns:ns0="urn:com.linde.sales">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>

    <xsl:template match="Facturae">
        <Facturae
            xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
			xmlns:facte="http://www.facturae.es/Facturae/2009/v3.2/Facturae" 
			xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </Facturae>
    </xsl:template>
</xsl:stylesheet>

Open in new window



Here is the final output

<?xml version="1.0" encoding="UTF-8"?><MT_EBILLING_TRC>
   <Facturae xmlns:facte="http://www.facturae.es/Facturae/2009/v3.2/Facturae" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
      <FileHeader>
         <SchemaVersion/>
         <Modality/>
         <InvoiceIssuerType/>
         <ThirdParty>
            <TaxIdentification>
               <PersonTypeCode/>
               <ResidenceTypeCode/>
               <TaxIdentificationNumber/>
            </TaxIdentification>
            <LegalEntity>
               <CorporateName/>
               <TradeName/>
               <RegistrationData>
                  <Book/>
                  <RegisterOfCompaniedLocation/>
                  <Sheet/>
                  <Folio/>
                  <Section/>
                  <Volume/>
                  <AdditionalRegistrationData/>
               </RegistrationData>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </LegalEntity>
            <Individual>
               <Name/>
               <FirstSurname/>
               <SecondSurname/>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </Individual>
         </ThirdParty>
         <Batch>
            <BatchIdentifier/>
            <InvoicesCount/>
            <TotalInvoicesAmount>
               <TotalAmount/>
               <EquivalentInEuros/>
            </TotalInvoicesAmount>
            <TotalOutstandingAmount>
               <TotalAmount/>
               <EquivalentInEuros/>
            </TotalOutstandingAmount>
            <TotalExecutableAmount>
               <TotalAmount/>
               <EquivalentInEuros/>
            </TotalExecutableAmount>
            <InvoiceCurrencyCode/>
         </Batch>
         <FactoringAssignmentData>
            <Assignee>
               <TaxIdentification>
                  <PersonTypeCode/>
                  <ResidenceTypeCode/>
                  <TaxIdentificationNumber/>
               </TaxIdentification>
               <LegalEntity>
                  <CorporateName/>
                  <TradeName/>
                  <RegistrationData>
                     <Book/>
                     <RegisterOfCompaniedLocation/>
                     <Sheet/>
                     <Folio/>
                     <Section/>
                     <Volume/>
                     <AdditionalRegistrationData/>
                  </RegistrationData>
                  <AddressInSpain>
                     <Address/>
                     <PostCode/>
                     <Town/>
                     <Province/>
                     <CountryCode/>
                  </AddressInSpain>
                  <OverseasAddress>
                     <Address/>
                     <PostCodeAndTown/>
                     <Province/>
                     <CountryCode/>
                  </OverseasAddress>
                  <ContactDetails>
                     <Telephone/>
                     <TeleFax/>
                     <WebAddress/>
                     <ElectronicMail/>
                     <ContactPersons/>
                     <CnoCnae/>
                     <INETownCode/>
                     <AdditionalContactDetails/>
                  </ContactDetails>
               </LegalEntity>
               <Individual>
                  <Name/>
                  <FirstSurname/>
                  <SecondSurname/>
                  <AddressInSpain>
                     <Address/>
                     <PostCode/>
                     <Town/>
                     <Province/>
                     <CountryCode/>
                  </AddressInSpain>
                  <OverseasAddress>
                     <Address/>
                     <PostCodeAndTown/>
                     <Province/>
                     <CountryCode/>
                  </OverseasAddress>
                  <ContactDetails>
                     <Telephone/>
                     <TeleFax/>
                     <WebAddress/>
                     <ElectronicMail/>
                     <ContactPersons/>
                     <CnoCnae/>
                     <INETownCode/>
                     <AdditionalContactDetails/>
                  </ContactDetails>
               </Individual>
            </Assignee>
            <PaymentDetails>
               <Installment>
                  <InstallmentDueDate/>
                  <InstallmentAmount/>
                  <PaymentMeans/>
                  <AccountToBeCredited>
                     <IBAN/>
                     <AccountNumber/>
                     <BankCode/>
                     <BranchCode/>
                     <BranchInSpainAddress>
                        <Address/>
                        <PostCode/>
                        <Town/>
                        <Province/>
                        <CountryCode/>
                     </BranchInSpainAddress>
                     <OverseasBranchAddress>
                        <Address/>
                        <PostCodeAndTown/>
                        <Province/>
                        <CountryCode/>
                     </OverseasBranchAddress>
                     <BIC/>
                  </AccountToBeCredited>
                  <PaymentReconciliationReference/>
                  <AccountToBeDebited>
                     <IBAN/>
                     <AccountNumber/>
                     <BankCode/>
                     <BranchCode/>
                     <BranchInSpainAddress>
                        <Address/>
                        <PostCode/>
                        <Town/>
                        <Province/>
                        <CountryCode/>
                     </BranchInSpainAddress>
                     <OverseasBranchAddress>
                        <Address/>
                        <PostCodeAndTown/>
                        <Province/>
                        <CountryCode/>
                     </OverseasBranchAddress>
                     <BIC/>
                  </AccountToBeDebited>
                  <CollectionAdditionalInformation/>
                  <RegulatoryReportingData/>
                  <DebitReconciliationReference/>
               </Installment>
            </PaymentDetails>
            <FactoringAssignmentClauses/>
         </FactoringAssignmentData>
      </FileHeader>
      <Parties>
         <SellerParty>
            <TaxIdentification>
               <PersonTypeCode/>
               <ResidenceTypeCode/>
               <TaxIdentificationNumber/>
            </TaxIdentification>
            <PartyIdentification/>
            <AdministrativeCentres>
               <AdministrativeCentre>
                  <CentreCode/>
                  <RoleTypeCode/>
                  <Name/>
                  <FirstSurname/>
                  <SecondSurname/>
                  <AddressInSpain>
                     <Address/>
                     <PostCode/>
                     <Town/>
                     <Province/>
                     <CountryCode/>
                  </AddressInSpain>
                  <OverseasAddress>
                     <Address/>
                     <PostCodeAndTown/>
                     <Province/>
                     <CountryCode/>
                  </OverseasAddress>
                  <ContactDetails>
                     <Telephone/>
                     <TeleFax/>
                     <WebAddress/>
                     <ElectronicMail/>
                     <ContactPersons/>
                     <CnoCnae/>
                     <INETownCode/>
                     <AdditionalContactDetails/>
                  </ContactDetails>
                  <PhysicalGLN/>
                  <LogicalOperationalPoint/>
                  <CentreDescription/>
               </AdministrativeCentre>
            </AdministrativeCentres>
            <LegalEntity>
               <CorporateName/>
               <TradeName/>
               <RegistrationData>
                  <Book/>
                  <RegisterOfCompaniedLocation/>
                  <Sheet/>
                  <Folio/>
                  <Section/>
                  <Volume/>
                  <AdditionalRegistrationData/>
               </RegistrationData>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </LegalEntity>
            <Individual>
               <Name/>
               <FirstSurname/>
               <SecondSurname/>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </Individual>
         </SellerParty>
         <BuyerParty>
            <TaxIdentification>
               <PersonTypeCode/>
               <ResidenceTypeCode/>
               <TaxIdentificationNumber/>
            </TaxIdentification>
            <PartyIdentification/>
            <AdministrativeCentres>
               <AdministrativeCentre>
                  <CentreCode/>
                  <RoleTypeCode/>
                  <Name/>
                  <FirstSurname/>
                  <SecondSurname/>
                  <AddressInSpain>
                     <Address/>
                     <PostCode/>
                     <Town/>
                     <Province/>
                     <CountryCode/>
                  </AddressInSpain>
                  <OverseasAddress>
                     <Address/>
                     <PostCodeAndTown/>
                     <Province/>
                     <CountryCode/>
                  </OverseasAddress>
                  <ContactDetails>
                     <Telephone/>
                     <TeleFax/>
                     <WebAddress/>
                     <ElectronicMail/>
                     <ContactPersons/>
                     <CnoCnae/>
                     <INETownCode/>
                     <AdditionalContactDetails/>
                  </ContactDetails>
                  <PhysicalGLN/>
                  <LogicalOperationalPoint/>
                  <CentreDescription/>
               </AdministrativeCentre>
            </AdministrativeCentres>
            <LegalEntity>
               <CorporateName/>
               <TradeName/>
               <RegistrationData>
                  <Book/>
                  <RegisterOfCompaniedLocation/>
                  <Sheet/>
                  <Folio/>
                  <Section/>
                  <Volume/>
                  <AdditionalRegistrationData/>
               </RegistrationData>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </LegalEntity>
            <Individual>
               <Name/>
               <FirstSurname/>
               <SecondSurname/>
               <AddressInSpain>
                  <Address/>
                  <PostCode/>
                  <Town/>
                  <Province/>
                  <CountryCode/>
               </AddressInSpain>
               <OverseasAddress>
                  <Address/>
                  <PostCodeAndTown/>
                  <Province/>
                  <CountryCode/>
               </OverseasAddress>
               <ContactDetails>
                  <Telephone/>
                  <TeleFax/>
                  <WebAddress/>
                  <ElectronicMail/>
                  <ContactPersons/>
                  <CnoCnae/>
                  <INETownCode/>
                  <AdditionalContactDetails/>
               </ContactDetails>
            </Individual>
         </BuyerParty>
      </Parties>
      <Invoices>
         <Invoice>
            <InvoiceHeader>
               <InvoiceNumber/>
               <InvoiceSeriesCode/>
               <InvoiceDocumentType/>
               <InvoiceClass/>
               <Corrective>
                  <InvoiceNumber/>
                  <InvoiceSeriesCode/>
                  <ReasonCode/>
                  <ReasonDescription/>
                  <TaxPeriod>
                     <StartDate/>
                     <EndDate/>
                  </TaxPeriod>
                  <CorrectionMethod/>
                  <CorrectionMethodDescription/>
                  <AdditionalReasonDescription/>
               </Corrective>
            </InvoiceHeader>
            <InvoiceIssueData>
               <IssueDate/>
               <OperationDate/>
               <PlaceOfIssue>
                  <PostCode/>
                  <PlaceOfIssueDescription/>
               </PlaceOfIssue>
               <InvoicingPeriod>
                  <StartDate/>
                  <EndDate/>
               </InvoicingPeriod>
               <InvoiceCurrencyCode/>
               <ExchangeRateDetails>
                  <ExchangeRate/>
                  <ExchangeRateDate/>
               </ExchangeRateDetails>
               <TaxCurrencyCode/>
               <LanguageName/>
            </InvoiceIssueData>
            <TaxesOutputs>
               <Tax>
                  <TaxTypeCode/>
                  <TaxRate/>
                  <TaxableBase>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </TaxableBase>
                  <TaxAmount>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </TaxAmount>
                  <SpecialTaxableBase>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </SpecialTaxableBase>
                  <SpecialTaxAmount>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </SpecialTaxAmount>
                  <EquivalenceSurcharge/>
                  <EquivalenceSurchargeAmount>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </EquivalenceSurchargeAmount>
               </Tax>
            </TaxesOutputs>
            <TaxesWithheld>
               <Tax>
                  <TaxTypeCode/>
                  <TaxRate/>
                  <TaxableBase>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </TaxableBase>
                  <TaxAmount>
                     <TotalAmount/>
                     <EquivalentInEuros/>
                  </TaxAmount>
               </Tax>
            </TaxesWithheld>
            <InvoiceTotals>
               <TotalGrossAmount/>
               <GeneralDiscounts>
                  <Discount>
                     <DiscountReason/>
                     <DiscountRate/>
                     <DiscountAmount/>
                  </Discount>
               </GeneralDiscounts>
               <GeneralSurcharges>
                  <Charge>
                     <ChargeReason/>
                     <ChargeRate/>
                     <ChargeAmount/>
                  </Charge>
               </GeneralSurcharges>
               <TotalGeneralDiscounts/>
               <TotalGeneralSurcharges/>
               <TotalGrossAmountBeforeTaxes/>
               <TotalTaxOutputs/>
               <TotalTaxesWithheld/>
               <InvoiceTotal/>
               <Subsidies>
                  <Subsidy>
                     <SubsidyDescription/>
                     <SubsidyRate/>
                     <SubsidyAmount/>
                  </Subsidy>
               </Subsidies>
               <PaymentsOnAccount>
                  <PaymentOnAccount>
                     <PaymentOnAccountDate/>
                     <PaymentOnAccountAmount/>
                  </PaymentOnAccount>
               </PaymentsOnAccount>
               <ReimbursableExpenses>
                  <ReimbursableExpenses>
                     <ReimbursableExpensesSellerParty>
                        <PersonTypeCode/>
                        <ResidenceTypeCode/>
                        <TaxIdentificationNumber/>
                     </ReimbursableExpensesSellerParty>
                     <ReimbursableExpensesBuyerParty>
                        <PersonTypeCode/>
                        <ResidenceTypeCode/>
                        <TaxIdentificationNumber/>
                     </ReimbursableExpensesBuyerParty>
                     <IssueDate/>
                     <InvoiceNumber/>
                     <InvoiceSeriesCode/>
                     <ReimbursableExpensesAmount/>
                  </ReimbursableExpenses>
               </ReimbursableExpenses>
               <TotalFinancialExpenses/>
               <TotalOutstandingAmount/>
               <TotalPaymentsOnAccount/>
               <AmountsWithheld>
                  <WithholdingReason/>
                  <WithholdingRate/>
                  <WithholdingAmount/>
               </AmountsWithheld>
               <TotalExecutableAmount/>
               <TotalReimbursableExpenses/>
            </InvoiceTotals>
            <Items>
               <InvoiceLine>
                  <IssuerContractReference/>
                  <IssuerContractDate/>
                  <IssuerTransactionReference/>
                  <IssuerTransactionDate/>
                  <ReceiverContractReference/>
                  <ReceiverContractDate/>
                  <ReceiverTransactionReference/>
                  <ReceiverTransactionDate/>
                  <FileReference/>
                  <FileDate/>
                  <SequenceNumber/>
                  <DeliveryNotesReferences>
                     <DeliveryNote>
                        <DeliveryNoteNumber/>
                        <DeliveryNoteDate/>
                     </DeliveryNote>
                  </DeliveryNotesReferences>
                  <ItemDescription/>
                  <Quantity/>
                  <UnitOfMeasure/>
                  <UnitPriceWithoutTax/>
                  <TotalCost/>
                  <DiscountsAndRebates>
                     <Discount>
                        <DiscountReason/>
                        <DiscountRate/>
                        <DiscountAmount/>
                     </Discount>
                  </DiscountsAndRebates>
                  <Charges>
                     <Charge>
                        <ChargeReason/>
                        <ChargeRate/>
                        <ChargeAmount/>
                     </Charge>
                  </Charges>
                  <GrossAmount/>
                  <TaxesWithheld>
                     <Tax>
                        <TaxTypeCode/>
                        <TaxRate/>
                        <TaxableBase>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </TaxableBase>
                        <TaxAmount>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </TaxAmount>
                     </Tax>
                  </TaxesWithheld>
                  <TaxesOutputs>
                     <Tax>
                        <TaxTypeCode/>
                        <TaxRate/>
                        <TaxableBase>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </TaxableBase>
                        <TaxAmount>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </TaxAmount>
                        <SpecialTaxableBase>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </SpecialTaxableBase>
                        <SpecialTaxAmount>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </SpecialTaxAmount>
                        <EquivalenceSurcharge/>
                        <EquivalenceSurchargeAmount>
                           <TotalAmount/>
                           <EquivalentInEuros/>
                        </EquivalenceSurchargeAmount>
                     </Tax>
                  </TaxesOutputs>
                  <LineItemPeriod>
                     <StartDate/>
                     <EndDate/>
                  </LineItemPeriod>
                  <TransactionDate/>
                  <AdditionalLineItemInformation/>
                  <SpecialTaxableEvent>
                     <SpecialTaxableEventCode/>
                     <SpecialTaxableEventReason/>
                  </SpecialTaxableEvent>
                  <ArticleCode/>
                  <Extensions/>
               </InvoiceLine>
            </Items>
            <PaymentDetails>
               <Installment>
                  <InstallmentDueDate/>
                  <InstallmentAmount/>
                  <PaymentMeans/>
                  <AccountToBeCredited>
                     <IBAN/>
                     <AccountNumber/>
                     <BankCode/>
                     <BranchCode/>
                     <BranchInSpainAddress>
                        <Address/>
                        <PostCode/>
                        <Town/>
                        <Province/>
                        <CountryCode/>
                     </BranchInSpainAddress>
                     <OverseasBranchAddress>
                        <Address/>
                        <PostCodeAndTown/>
                        <Province/>
                        <CountryCode/>
                     </OverseasBranchAddress>
                     <BIC/>
                  </AccountToBeCredited>
                  <PaymentReconciliationReference/>
                  <AccountToBeDebited>
                     <IBAN/>
                     <AccountNumber/>
                     <BankCode/>
                     <BranchCode/>
                     <BranchInSpainAddress>
                        <Address/>
                        <PostCode/>
                        <Town/>
                        <Province/>
                        <CountryCode/>
                     </BranchInSpainAddress>
                     <OverseasBranchAddress>
                        <Address/>
                        <PostCodeAndTown/>
                        <Province/>
                        <CountryCode/>
                     </OverseasBranchAddress>
                     <BIC/>
                  </AccountToBeDebited>
                  <CollectionAdditionalInformation/>
                  <RegulatoryReportingData/>
                  <DebitReconciliationReference/>
               </Installment>
            </PaymentDetails>
            <LegalLiterals>
               <LegalReference/>
            </LegalLiterals>
            <AdditionalData>
               <RelatedInvoice/>
               <RelatedDocuments>
                  <Attachment>
                     <AttachmentCompressionAlgorithm/>
                     <AttachmentFormat/>
                     <AttachmentEncoding/>
                     <AttachmentDescription/>
                     <AttachmentData/>
                  </Attachment>
               </RelatedDocuments>
               <InvoiceAdditionalInformation/>
               <Extensions/>
            </AdditionalData>
         </Invoice>
      </Invoices>
      <Extensions/>
   </Facturae>
</MT_EBILLING_TRC>

Open in new window

0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 41883040
I would like to point out that your "I am able to remove the unwanted tags" has resulted in an XML that is fundamentally different from your original question

Please be very much aware that
  <Facturae xmlns:facte="http://www.facturae.es/Facturae/2009/v3.2/Facturae" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
      <FileHeader>...

Is very different from
  <xy:Facturae xmlns="http://www.facturae.es/Facturae/2009/v3.2/Facturae" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
      <FileHeader>

Your original question asked for FileHeader to be in the default namespace, similar to the second example
You now seem to want that FileHeader is in the null namespace as in the first example and as implied by your "solution"

If you are unaware of the difference please check the required end result for correctness
If you are aware of the difference, you should have been a lot more carefull posting your question, much energy has been lost in this confusion
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 41883045
This template is not firing
<xsl:template match="MT_EBILLING_TRC">
        <xsl:element name="ns0:{name()}" xmlns:ns0="urn:com.linde.sales">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>

Open in new window


because you are addressing  the MT_EBILLING_TRC in the null namespace, that simply does not exist
MT_EBILLING_TRC is in the "urn:com.sales" namespace as implied by the binding
<ns0:MT_EBILLING_TRC xmlns:ns0="urn:com.sales">

try this instead
<xsl:template match="ns0:MT_EBILLING_TRC"  xmlns:ns0="urn:com.sales">
        <xsl:element name="ns0:{name()}" xmlns:ns0="urn:com.linde.sales">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>

Open in new window


I would suggest you do some serious reading on namespaces
0
 

Author Comment

by:kalyangkm
ID: 41883144
Hi Geert,

I understand I have wasted your time and I apologize. But not that you are looking points, I will still alot full points. I just need this to be fixed as I dont have time. I completely understand that I need to do reading on the namespaces. For now if you can help I would appreciate.

I tried your corrected code but now it doesnt seems to like putting the namespace in the tamplate match. PFA is the error.

THis is what I used as you suggested just with a small correction on the namespace

    <xsl:template match= "ns0:MT_EBILLING_TRC" xmlns:ns0="urn:com.linde.sales">
        <xsl:element name="ns0:{name()}" xmlns:ns0="urn:com.linde.sales">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>
Capture.JPG
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 41883492
Don't worry about the points, I don't worry about them and I don't care.
This is all about helping people and the time I spent trying to figure out what exactly is the question, is time I can not help others

I have put that last bit down untested, about to go to bed,
looking at the code, I don't think the problem is the prefix in the template match

It is no good idea to have an equal prefix switch namespace over two lines, it is allowed but confusing for the reader
so change the first line to
    <xsl:template match= "ns1:MT_EBILLING_TRC" xmlns:ns1="urn:com.sales">

given the name has a prefix, the element constructor should have local-name() instead of name()
that likely is the problem

If not, what is the tool you are using?
0
 

Author Comment

by:kalyangkm
ID: 41884070
Cool. It works now with the changes. Thanks I appreciate it.

Regards
kalyan.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 41884262
welcome
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A short article about problems I had with the new location API and permissions in Marshmallow
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now