Skip to content

Instantly share code, notes, and snippets.

@mathias-goebel
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathias-goebel/bcc7e3d0db35ce1bb3bf to your computer and use it in GitHub Desktop.
Save mathias-goebel/bcc7e3d0db35ce1bb3bf to your computer and use it in GitHub Desktop.
selected XQuery snippets
several useful XQuery snippets, mainly used with eXist-db
xquery version "3.0";
declare namespace xhtml="http://www.w3.org/1999/xhtml";
let
$colllection := '/db/apps/plays/templates',
$attribute-name := 'data-template-with',
$attribute-value := 'page.html',
$new-value := 'templates/page.html'
return
for $doc in collection($collection)//xhtml:div[@*[name() = $attribute-name]=$attribute-value]/base-uri()
let $item := doc(string($doc))
return
update value $item/xhtml:div[@*[name() = $attribute-name]]/@*[name() = $attribute-name] with $new-value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment