I did post this question to a thread from 2011 (Get text inside xml tag using grep). I did try to get the final answer to work using commandline arguments ($1=filname, $2=tagname) instead of the fixed names:
grep -E -m 1 -o "<$2>(.*)</$2>" ./private/$1.xml | sed -e 's,.*<$2>\([^<]*\)</$2>.*,\1,g'
Apparantly this does not work, because the part after the pipe doesn't get the argument $2. I am a total linux noob, but my hunch is that the pipe starts a new process that does not get the parent arguments. I tried Google for quite some time, but do get more confused. Is there a simple work around for this?