Sensor as input for other sensor

I’m trying to use a sensor as an input for an other sensor, but I can’t figure out exactly how to do it.
My code:

template:
  - sensor:
      - name: "Next train to Den Haag"
        state: "{{state_attr('sensor.leiden_cs_den_haag_cs', 'next')}}"

sensor:
  - platform: nederlandse_spoorwegen
    api_key: 12345678
    routes:
      - name: Leiden CS-Den Haag CS
        from: Ledn
        to: Gvc
        time: "{{ here I need sensor.next_time_to_den_haag but I don't know how }}"

Can anyone help me please?

time: "{{ states('sensor.next_time_to_den_haag') }}"

but why are you creating a sensor for the time when you can put the same template directly into the sensor you want?

do you need that template sensor somewhere else?