Filtering by text length

Task

Source document

<persons>
  <person firstName="Hans" lastName="Mustermann" age="28" />
  <person firstName="Herbert" lastName="Möllemann" age="33" />
  <person firstName="Peter" lastName="Meier" age="37" />
  <person firstName="Ulrike" lastName="Albrecht" age="45" />
  <person firstName="Uwe" lastName="Peters" age="34" />
</persons>

Challenge

Select all person elements with an attribute “firstName” a maximum of 5 characters long.

Desired selection (XML-output)

  • <person firstName="Hans" lastName="Mustermann" age="28" />
  • <person firstName="Peter" lastName="Meier" age="37" />
  • <person firstName="Uwe" lastName="Peters" age="34" />

Exercise

Your input

Eine Lösung wäre: Lösung