If both supplier and customer are located in Germany, the element "Buyer reference" (BT-10) shall be provided.
(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]cbc:BuyerReference[boolean(normalize-space(.))]