Hi Brenda,
Could be as simple as this: xdmp:node-replace($userpref/pr:value, $syspref/pr:value) Add it somewhere in the return. See also http://docs.marklogic.com/xdmp:node-replace Kind regards, Geert *Van:* [email protected] [mailto: [email protected]] *Namens *Brenda King-Wade *Verzonden:* woensdag 13 november 2013 5:09 *Aan:* [email protected] *CC:* [email protected] *Onderwerp:* [MarkLogic Dev General] How to update node based on query results I need to update database values (nodes) based on query results. XQuery to get users preferences not equal to system preferences sends back results. How do I change a user preference value in the database based on results? xquery version "1.0-ml"; declare namespace html = "http://www.w3.org/1999/xhtml"; declare namespace pr="http://www.gsa.gov/services/preferences"; <results> { for $syspref in doc("system-preferences.xml")/pr:preference/pr:systemPreferences/pr:userDefaultPreference, $userpref in doc("user-preferences.xml")/pr:preference/pr:userPreferences/pr:userDefaultPreference where $syspref/pr:key = $userpref/pr:key and $syspref/pr:value != $userpref/pr:value return <result> {$syspref/pr:key} {$userpref/pr:key} {$syspref/pr:value} {$userpref/pr:value} {$userpref/pr:defaultPreference} </result> } </results> Thanks in advance!
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
