Hi Christian,

The complete query is: 

let $node :=
 copy $c :=
   <entry>
     <title>entry title</title>
     <content>entry content</content>
   </entry>
 modify (
   return replace value of node $c/title with 'new entry title', 
   return replace value of node $c/content with 'new entry content'
 )
 return $c
return replace node doc('doc1')/entry with $node 

Note: doc1 is a document in the database with 'entry' as the root element.

- Sony

On Tue, Apr 26, 2011 at 10:40 AM, Christian Grün <christian.gruen@gmail.com> wrote:
Sony,

please provide complete queries, otherwise it's difficult to give
constructive feedback (e.g.: $entry isn't specified anywhere, etc).

Christian


On Tue, Apr 26, 2011 at 3:59 PM, Sony Vijay <sony.vibh@gmail.com> wrote:
> Hi,
> I am wondering if there is a way to convert a String into a Node within
> XQuery.
> For example, consider the xquery
> let $node :=
>  copy $c :=
>    <entry>
>      <title>entry title</title>
>      <content>entry content</content>
>    </entry>
>  modify (
>    return replace value of node $entry/title with 'new entry title',
>    return replace value of node $entry/content with 'new entry content'
>  )
>  return $c
>
> return replace node doc('doc1')/entry with $c
> The above xquery throws the error: [XPTY0019] Context node required for
> entry; xs:string found. How do I fix this ?
> Thanks,
> Sony
>
> _______________________________________________
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>
>