[MarkLogic Dev General] xdmp and update type problem

erinemiller at comcast.net erinemiller at comcast.net
Mon Oct 13 08:08:48 PDT 2008


Geert,
Thank you SO much for taking a look at this and also the code--this makes perfect sense.  I'm very appreciative!

Erin
-------------- Original message -------------- 
From: Geert Josten <Geert.Josten at daidalos.nl> 

> Hi Erin, 
> 
> The first function returns a sequence of 'string' element nodes, but in your 
> second function you call the 'data' function, which flattens the sequence of 
> element nodes to a sequence of strings (or other atomic datatypes if 
> appropriate). Node-replace only allows nodes, not atomic datatypes.. 
> 
> I reccon that it will work much better if you drop the call to data() and 
> directly iterate over the results of my:getName().. 
> 
> Kind regards, 
> Geert 
> 
> > 
> 
> 
> Drs. G.P.H. Josten 
> Consultant 
> 
> 
> http://www.daidalos.nl/ 
> Daidalos BV 
> Source of Innovation 
> Hoekeindsehof 1-4 
> 2665 JZ Bleiswijk 
> Tel.: +31 (0) 10 850 1200 
> Fax: +31 (0) 10 850 1199 
> http://www.daidalos.nl/ 
> KvK 27164984 
> De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos 
> BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht 
> onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht 
> kunnen geen rechten worden ontleend. 
> 
> 
> > From: Erin 
> > Sent: maandag 13 oktober 2008 15:02 
> > 
> > 
> > Sorry, stray code in there--it actually looks like this; 
> > (: Declare a namespace for my function :) 
> > declare namespace my = "http://www.EMtest.com"; 
> > declare function my:getName()as node()* 
> > { 
> > for $track in doc("EMLibrary.xml") 
> > //dict/dict[preceding-sibling::key[1] = "Tracks"]/dict/string[1] 
> > let $orig := xdmp:get-request-field("origTitle") 
> > 
> > where ($track = $orig) 
> > return $track 
> > }; 
> > 
> > (: Declare a function to get all the artists in my iTunes file :) 
> > declare function my:updateTitle() 
> > { 
> > if (doc("EMLibrary.xml")) then 
> > 
> > for $name in (data(my:getName())) 
> > let $title := xdmp:get-request-field("title") 
> > let $artist :=xdmp:get-request-field("artist") 
> > return 
> > if ($name) then 
> > ( 
> > xdmp:node-replace($name, {$title} 
> > ), 
> > xdmp:redirect-response("itemDetail.xqy?artist='{$artist}'") 
> > ) 
> 
> 
> _______________________________________________ 
> General mailing list 
> General at developer.marklogic.com 
> http://xqzone.com/mailman/listinfo/general 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20081013/3761de06/attachment.html


More information about the General mailing list