All die, and O! the embarrassment!

It should indeed!

Thank you, Christian.

On Wed, Jan 9, 2019 at 12:42 PM Christian Grün <christian.gruen@gmail.com> wrote:
Hi Graydon,

  $c/descendant::text()[normalize-space]

Maybe it should be as follows?

  $c/descendant::text()[normalize-space()]

Cheers,
Christian




Am Mi., 9. Jan. 2019, 18:35 hat Graydon Saunders <graydonish@gmail.com> geschrieben:
Hello!

I'm using BaseX 9.1.1 on Linux.

So I need to go through a whole bunch of documents and emit them in an obfusticated form so the folks doing publication development can have them without the client's security people becoming upset.  I don't want to obfusticate the db contents; I just want to be able to write out an obfusticated version.

Minimal example:

declare function local:gib($in as text()) as text() {
  text { 'ABCD' }
};

declare function local:obfusc($in as document-node()) as document-node() {
    copy $c := $in
    modify (
      for $x in $c/descendant::text()[normalize-space] 
      return replace node $x with local:gib($x)
    )
    return $c
};

for $doc in db:open('out')[contains(document-uri(),'/scr_')][1]
  let $blurred := local:obfusc($doc)
  return $blurred

If I run this, I get $doc back unaltered.  If I look at the optimized query, it looks like it ought to be changing things.

What am I doing wrong?

Thanks!
Graydon