I've created an XML file, but I need to change the order of elements. I need that first element under Invoice be cec:UBLExtensions with child elements (than cbc:CustomizationID and other in same order) My XML file is:
-<Invoice>
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:mfin.gov.rs:srbdt:2021</cbc:CustomizationID>
<cbc:ID>701708-2022</cbc:ID>
<cbc:IssueDate>2022-11-06</cbc:IssueDate>
<cbc:DueDate>2022-11-21</cbc:DueDate>
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
<cbc:Note>Nema oslobadjanja dobara od PDV-a</cbc:Note>
<cbc:DocumentCurrencyCode>RSD</cbc:DocumentCurrencyCode>
-<cec:UBLExtensions>
-<cec:UBLExtension>
-<cec:ExtensionContent>
</cec:ExtensionContent>
</cec:UBLExtension>
</cec:UBLExtensions>
-<cac:InvoicePeriod>
<cbc:DescriptionCode>35</cbc:DescriptionCode>
</cac:InvoicePeriod>
</Invoice>
I tried:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
<xsl:template match="Invoice">
<xsl:copy>
<xsl:apply-templates select="* except (cbc:CustomizationID,
cbc:ID, cbc:IssueDate, cbc:DueDate, cbc:InvoiceTypeCode, cbc:DocumentCurrencyCode, cec:UBLExtensions, cac:InvoicePeriod)"/>
<xsl:apply-templates select="cec:UBLExtensions, cbc:CustomizationID,
cbc:ID, cbc:IssueDate, cbc:DueDate, cbc:InvoiceTypeCode, cbc:DocumentCurrencyCode,cac: InvoicePeriod"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
</xsl:template>
</xsl:transform>
How it is possible with XSLT?