Counting elements selected by certain criteria

Task

Source document

<collection>
  <artist>
    <name>Robbie Williams</name>
    <cds>
      <cd>Rudebox</cd>
      <cd>Swing when you're winning</cd>
    </cds>
  </artist>
  <band>
    <name>Juli</name>
    <cds>
      <cd>Ein neuer Tag</cd>
    </cds>
  </band>
  <band>
    <name>Silbermond</name>
    <cds>
      <cd>Verschwende deine Zeit</cd>
    </cds>
  </band>
  <artist>
    <name>Michael Jackson</name>
    <cds>
      <cd>Bad</cd>
      <cd>Thriller</cd>
    </cds>
  </artist>
</collection>

Challenge

Output in the sentence below how many albums in the collection are by solo artists (artist) and how many are by bands (band).

Desired selection (text output)

In der Sammlung gibt es 4 Alben von Solokünstlern und 2 Alben von Bands.

Exercise

Your input

Eine Lösung wäre: Lösung