You should only do one or the other. In this case...
# advancedpdf
s
You should only do one or the other. In this case, the second call is effectively undoing the first, and making the entire template just your xmlStr variable.