Subject:Problem with namespace prefix in xquery Author:Bruce Cantor Date:16 Dec 2021 09:46 AM Originally Posted: 15 Dec 2021 11:11 AM
Hi
I have this weird issue with my xquery script.
The below script returns XML where the namespace prefixes are changed to weird generated namespace prefixes.
The result is valid, but is looking weird.
The namespace changes are located within the output for all elements included in the for loop, resulting in elements looking like this:
for $Dispatch in /a:DispatchAdvice/a:Dispatch
return
<b:DespatchAdvice xmlns:b="urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
<cbc:UBLVersionID>2.1</cbc:UBLVersionID>
<cbc:CustomizationID>somthing</cbc:CustomizationID>
<cbc:ProfileID>gggggg</cbc:ProfileID>
<cbc:ID>TODO: dispatch ID missing from Generic file</cbc:ID>
Simply renaming the namespace prefixes to cbc1, cac1 as following, prevents the XQuery engine to create additional namespace declarations in the query output