Foreach creates empty <li> Tags

I am building a faq-list using the kirby builder plugin by Tim Oetting.
Everything works fine, as long as I loop through the whole fieldset.
Now I’m trying to access only the ‘question’ field,
which generates an empty li element before the actual content.
I guess, it’s because there is also the ‘faq_headline’ in the blueprint,
or the ‘antwort’ field, but I don’t know how to get this right…
Any help is much appreciated!
Thank You

#faq.yml

  builder:
    label: FAQ-Abschnitt
    type: builder

    fieldsets:
      
      faq_headline:
        label: Überschrift
        snippet: sections/faq_headline
        fields:
          headline:
            label: Überschrift
            text:
              type: simplemde
      
      faq:
        label: Frage / Antwort
        snippet: sections/faq
        fields:
          frage:
            label: Frage
            type: text
          antwort:
            label: Antwort
            type: simplemde

template:

#templates/faq.php
<ol>
	<?php foreach($page->builder()->toStructure() as $section): ?>
		<li><?= $section->frage()->kt() ?></li>
	<?php endforeach ?>
</ol>

screenshot

The builder snippet is usually used with snippets for each section. In your case, where you only want to display the faqs - or rather only the questions . you can filter your sets:

<ol>
<?php foreach($page->builder()->toStructure()->filterBy('_fieldset', 'faq') as $section): ?>
 <li> <?= $section->frage() ?></li>
<?php endforeach ?>
</ol>

Note that you will still get empty tags in case a field is empty. If you want to prevent this:

<ol>
<?php foreach($page->builder()->toStructure()->filterBy('_fieldset', 'faq') as $section): ?>
  <?php if($section->frage()->isNotEmpty(): ?>
   <li><?= $section->frage() ?></li>
  <?php endif ?>
<?php endforeach ?>
</ol>

Ah, that’s awesome!
I already tried the filterBy approach but I obviously did something wrong.
Thank You @texnixe ! :slightly_smiling_face: