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, <string> {$title}
> </string>),
>         xdmp:redirect-response("itemDetail.xqy?artist='{$artist}'")
>          )


_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to