Hi Christian,

 

I encountered this erroneous behavior while using the for-each-function on a set with child-elements.

The evident work-around [2] workd fine.

I’m using BaseX 9.6 RC2.

I attached the code as attachment.

Hope this helps.

 

[1]

let       $context := <A><B1><C11></C11><C12></C12></B1><B2><C21></C21></B2></A>

 

let       $context.processor :=

function( $context           as element( )

        , $context.processor as function(*)

        )                    as map(*)

        { map { $context => name() : $context/child::*

                                     => for-each( $context.processor( ?

                                                                    , $context.processor

                                                                    )

                                                )

              }

        }

return    $context

          => $context.processor( $context.processor

                               )

[2]

let       $context := <A><B1><C11></C11><C12></C12></B1><B2><C21></C21></B2></A>

 

let       $context.processor :=

function( $context           as element( )

        , $context.processor as function(*)

        )                    as map(*)

        { map { $context => name() : $context/child::*

                                     => for-each( function( $child as element( )

                                                          )

                                                          { $child

                                                            => $context.processor( $context.processor

                                                                                 )

                                                          }

                                                )

              }

        }

return    $context

          => $context.processor( $context.processor

                               )

 

Rob

 

Sent from Mail for Windows

 


Virus-free. www.avast.com