Here's how I would approach this:
On your frontend, you have a web form asking the user for input, for the different settings/parameters that need to be set/unset.
When user clicks SUBMIT on the form, the whole form contents are sent to a backend program.
On your server, a program processes the form inputs, does validation, etc.
You also have a static template text file which contains your base XML configuration files. The only difference being, the actual values have placeholders in them. By having the template as a separate text file, you can easily update the formatting, add future fields, etc.
Your backend program reads this text file, and stores content in memory/variable.
Then your program processes the form variables, and just does a find/replace
value of bookid from form ---> replace $$bookid$$ text string
value of author entered from form ---> replace $$author$$ text string
At the end of your replace operation, you now have an XML file that contains the correct settings for each xml field.
Now it's just a matter of either outputting the contents of this variable on your browser screen (for cut and paste), or sending to the user a downloadable XML file.