Hi Rob, I’ve created an issue to track this down [1]. And I remember you have posted a similar bug in the past [2]… The challenge was/is to find out at compile time if a function is being inlined that has already been inlined. Another workaround: $context/child::* ! $context.processor(., $context.processor) Cheers, Christian [1] https://github.com/BaseXdb/basex/issues/2033 [2] https://github.com/BaseXdb/basex/issues/879 On Sat, Aug 14, 2021 at 10:37 AM Rob Stapper <r.stapper@lijbrandt.nl> wrote:
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 <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=icon> Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=link> <#m_3245395734233364133_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>