I currently have a WinForms app that uses XML documents to drive dynamic content that is shown to the user. I call these XML documents template files.

The template file determines the features the user sees, the properties, what type of control to use for the property, the drop items in the combo boxes and how to validate the input. I could go on with the dynamic content the template determines but you get the picture. The template drives the app, and the template file that is used by the program is determined when the user indicates which county they are interested in.

This is done because the app helps users submit engineering data to individual councils or counties. Each county has their own set of requirements, the information they need from the user and how best to validate that date.

So to solve this I put the information for each county in their own template file, the user selects the county they are working for and then from that point forward the program uses that county's template file to dynamically build the content in the forms and displays it to the user.

I am now moving the app to the web. My question is: is this technique of using an XML template file for each county to dynamically build the content the best way to do this for websites? I was wondering if anyone knows of a popular design pattern for websites to generate dynamic content for many different counties without having to build a different set of concrete web pages for each county? Or should I stay with the template file paradigm (i.e. if it ain't broken ...)?

  • I would imagine that your template approach to content generation would only be tractable server-side, unless you plan on rewriting your template engine in Javascript. Any thoughts on that? Commented Feb 28, 2018 at 20:38
  • Yes I imagine it will be mostly server-side for content generation. I want use this opportunity to design it as best as I can. So I am open to ideas, including how to incorporate as much Javascript as I can.
    – scott_f
    Commented Feb 28, 2018 at 20:51
  • I don't know what you mean by "incorporate as much Javascript as I can" (I would think you would want the opposite), but server-side generation of (at least a skeleton of) the HTML seems like a reasonable approach to me. Commented Feb 28, 2018 at 20:54
  • have you invented XAML?
    – Ewan
    Commented Mar 1, 2018 at 15:49
  • Close but not really. Conceptually at a high level my xml template and XAML sound like they get you to the same place... end the end. But not really :-) Anyway, this is a WinForms app, I never did get into WPF so I have not used XAML a lot.
    – scott_f
    Commented Mar 2, 2018 at 23:06

1 Answer 1


I used to write templated websites like your example. But I stopped, and moved to just coding out the different forms.

My experience was that maintaining a complex templating language/format was more work than hand coding each version.

The original requirements around users creating their own forms always ended up being 'the user requests a new form be developed' and new requirements would always expand the scope of the templating language until it was as complex as the code it was replacing.

I would say stick with resx files for languages and try to make a multitenant site which includes separate pages for each country where required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.