Hi Geert,
Sure--here's the node selection:
declare function my:getName()as node()*
{
for $track in doc("EMLibrary.xml")
//dict/dict[preceding-sibling::key[1] =
"Tracks"]/dict/string[preceding-sibling::key[1]]
let $orig := xdmp:get-request-field("origTitle")
where ($track = $orig)
return $track
};
And then here's the update, or a piece of it:
(: 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")
let $name :=/preceding-sibling::$name
return
if ($name) then
(
xdmp:node-replace($name, <string> {$title} </string>),
xdmp:redirect-response("itemDetail.xqy?artist='{$artist}'")
)
....
Many thanks,
Erin
-------------- Original message --------------
From: Geert Josten <[EMAIL PROTECTED]>
> Hi Erin,
>
> Can you us the code snippet containing the node selection and the call to the
> node-replace function?
>
> 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: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of
> > [EMAIL PROTECTED]
> > Sent: maandag 13 oktober 2008 6:30
> > To: [email protected]
> > Subject: [MarkLogic Dev General] xdmp and update type problem
> >
> > Hello All,
> > I'm new to MarkLogic and I have a question about updating a
> > document node. Here's my problem:
> > I'm going through the nodes in my document to find a specific
> > node. Here's what my XPath looks like:
> >
> > //dict/dict[preceding-sibling::key[1] =
> > "Tracks"]/dict/string[preceding-sibling::key[1]]
> > My XML is like:
> >
> > ...
> >
> >
> >
> > ...
> >
> > Tracks
> >
> >
> >
> > < key>Track ID
> >
> > 867
> > Name
> > Air
> >
> > ...
> >
> >
> >
> > That should return a node that looks like:
> > Air
> > So it's technically returning an element node--I've also
> > tried xdmp:node-kind and that gives me "element."
> >
> > But when I try to update, I get this error:
> >
> > [1.0-ml] XDMP-ARGTYPE: (err:XPTY0004)
> > xdmp:node-replace(xs:untypedAtomic("Air"),
> > Air2) -- arg1 is not of type node()
> >
> > It seems like instead of getting back:
> >
> > Air
> >
> > I'm actually just getting:
> >
> > Air
> >
> > Which I can't use to update the node since it isn't a node.
> >
> > Can anyone point me in the right direction?
> >
> > Thanks!
> >
> > Erin
> >
> >
> >
> >
> >
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general _______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general