Can I please be removed from this email stream.

Thanks,

Pete

On Wed, Sep 19, 2012 at 12:21 PM, Michael Blakeley <[email protected]> wrote:
> The heart of the update expression is something like:
>
>     xdmp:node-insert-child($a/xm:meta, $new-node)
>
> Each node-insert-child should add a node to the end of the existing children 
> of $a/xm:meta, like a FIFO. But "$a" is undefined, so it's difficult to 
> predict how this will evaluate. If you can provide a working test case, 
> someone here can probably tell you what is going awry.
>
> -- Mike
>
> On 19 Sep 2012, at 08:42 , Dominic Beesley wrote:
>
>> Hi Damon,
>>
>> Thanks for the suggestion. I think something along those lines is the way 
>> I’ll have to go, just seems a bit odd having to rebuild a whole, quite large 
>> item rather than being able to poke a few in at the end!
>>
>> Thanks
>>
>> Dom
>>
>> From: [email protected] 
>> [mailto:[email protected]] On Behalf OfDamon Feldman
>> Sent: 19 September 2012 14:20
>> To: MarkLogic Developer Discussion
>> Subject: Re: [MarkLogic Dev General] Multiple inserts, maintaining order
>>
>> Dominic,
>>
>> You could instead build the sequence, merge it together and then replace the 
>> whole meta node. Un-tested code:
>>
>> Let $new-fields := for …. return <xm:field type='subject-link'> <xa:link Let 
>> $old-meta := …
>> Let $old-fields := $old-meta//xm:field
>> Let $new-fields := ($old-fields, $new-fields)
>> Let $new-meta :=
>>   <xm:meta> {
>>     {$old-meta/@*}  (: keep all old attributes :)
>>     {$old-meta/node()[local-name(.) ne “field”]  (: keep all nodes except 
>> fields :)
>>     {$new-fields} (: add merged fields at the bottom :)
>> }
>> </xm:meta>
>>
>> If you need the xm:meta to have the fields in the middle somewhere, that can 
>> be done, but is trickier.
>>
>> Yours,
>> Damon
>>
>> From: [email protected] 
>> [mailto:[email protected]] On Behalf OfDominic Beesley
>> Sent: Wednesday, September 19, 2012 9:08 AM
>> To: 'MarkLogic Developer Discussion'
>> Subject: [MarkLogic Dev General] Multiple inserts, maintaining order
>>
>> Hello,
>>
>> I’m trying to insert multiple nodes into a document, the nodes are getting 
>> inserted ok but the order is jumbled up.
>>
>> I’m guessing this is something to do with how transactions are committed 
>> after the script has finished.
>>
>> Is there an easy way round this or a way of building a set of nodes in the 
>> correct order and inserting them in one go to the parent?
>>
>> Thanks
>>
>> Dom
>>
>> Snippet:
>>
>> for $k in (
>> for $kk in $keys
>>                 return
>>                 $tax2//a[@id=$kk]
>>                 )
>>                 order by xs:integer($k/@index) descending
>> return
>> (
>>                 concat(' - ACTUAL=', $k/@name, ' - ', $k/@id, ' - ', 
>> $k/@index, '&#13;&#10;'),
>>                 xdmp:node-insert-child(
>> $a/xm:meta,
>>                                 <xm:field type='subject-link'>
>>                                                 <xa:link link-type='{ 
>> concat($a/@type, "-taxonomy-subject-law") }' dest-id='{ $k/@id }' />
>>                                 </xm:field>
>>                 )
>> )
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to