getElements function

generic function to extract elements-slot