Link to home
Start Free TrialLog in
Avatar of kalyangkm
kalyangkmFlag for United States of America

asked on

Adding Namespace to the second node of the xml

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>
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

<?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

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
Avatar of kalyangkm

ASKER

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>
"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"
Oh, If you simply just copy / pasted my code in your comment... please note that you missed the closing xsl:stylesheet tag
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.
I think you forgot to copy the

</xsl:stylesheet>

at the end
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">
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
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

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
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
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
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cool. It works now with the changes. Thanks I appreciate it.

Regards
kalyan.