Skip to content

Instantly share code, notes, and snippets.

@EdWarga
Last active August 29, 2015 14:19
Show Gist options
  • Save EdWarga/de3f1ea6b2b76f1df16c to your computer and use it in GitHub Desktop.
Save EdWarga/de3f1ea6b2b76f1df16c to your computer and use it in GitHub Desktop.
Replace value of all refids in collection with the normalized value
xquery version "3.0";
declare namespace vra="http://www.vraweb.org/vracore4.htm";
let $records := fn:collection("1941")
for $refid in $records//@refid
return
replace value of node $refid with fn:normalize-space($refid)
@EdWarga
Copy link
Author

EdWarga commented Apr 18, 2015

The above code replaced all @refid with normalized version. This updated all the files in the db. I then exported the db to disk using the GUI (Export Data (BaseX: http://docs.basex.org/wiki/Databases#Export_Data)

@EdWarga
Copy link
Author

EdWarga commented Apr 18, 2015

Here's the documentation on the replace expression: http://docs.basex.org/wiki/XQuery_Update#replace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment