How to splice an xpath containing variables

Are you thinking of the below technique: