create or replace view peppol_invoice_tax_total_tax_subtotal_xv as select seq_id, invoice_id, "@currencyID" ,xmlelement("cac:TaxSubtotal" ,xmlconcat( case when "TaxableAmount" is null then null else xmlelement("cbc:TaxableAmount", xmlattributes("TaxableAmount_@currencyID" as "currencyID"), "TaxableAmount" ) end, case when "TaxAmount" is null then null else xmlelement("cbc:TaxAmount", xmlattributes("TaxAmount_@currencyID" as "currencyID"), "TaxAmount" ) end, xmlforest( xmlforest( "TaxCategory_ID" as "cbc:ID" ,"TaxCategory_Percent" as "cbc:Percent" ,xmlforest( "TaxCategory_TaxScheme_ID" as "cbc:ID" ) as "cac:TaxScheme" ) as "cac:TaxCategory" ) ) ) "TaxSubtotal" from peppol_invoice_tax_total_tax_subtotal_v;