For testing purposes, you can always set the BaseX STRIPNS option when
creating a database.

If you want to have your database untouched, a solution in XQuery
looks as follows (…we should finally introduce a strip-namespaces()
function):

declare function local:strip($n) {
  typeswitch($n)
    case document-node() return
      document { $n/(@*, node()) ! local:strip(.) }
    case element() return
      element { local-name($n) } { $n/(@*, node()) ! local:strip(.) }
    case attribute() return
      attribute { local-name($n) } { $n }
    default return
      $n
};

local:strip(
  <x xmlns='x' a:a='A' xmlns:a='a'>
    <?pi PI ?>BLA<!-- COMMENT -->
    <c a:a='A'/>
  </x>
)



On Thu, Jul 22, 2021 at 3:32 PM Jonathan Robie <[email protected]> wrote:
>
> I am playing with datasets in which namespaces are unhelpful because they 
> make output harder to read.  For production use, though, I want the 
> namespaces to be there.
>
> Ideally, I would like to tell BaseX to drop namespaces while serializing.  
> Sometimes.  Ideally, I would like to be able to set this as an option in a 
> .bxs file.  Is that possible?
>
> Thanks!
>
> Jonathan

Reply via email to