There is a bit more to it.
I looked up the specs for a DL06 DC input:
The DL06 can source 24Vdc at one of it's pins, so I am using that as the power supply. The maximum pull-up resistor (to 24V) that would satisfy the DL06 input requirement is about 2K, so in the low state, the switching transistor Q1 would have to sink ~6mA.
Since you didn't specify what sort of load the sensor can drive, I use a second 2N3904 (Q2) primarily to keep the input impedance high (so as not to load the sensor), and to make it so that there is no net inversion between the sensor and the input:
The unknown source resistance Rs could be anything from zero to ~50KΩ and the circuit would still work...
The trip point for V(sensor) is about 0.7V. The current from the sensor is shown as I(R1). The voltage to the PLC V(plcin) satisfies the spec, and is >12V.
ps: One other potential problem occurred to me after the fact. Is the return for the PLC's 24V power supply connected to the common pin for all of the inputs? if not, you might need a separate, external, floating 24Vdc power supply to power the interface circuit?
Alternatively, you could tie the opt0-isolated "common" pin to the the PLC's Gnd, but that would undo the opto-isolation on the inputs...