-1

I have a deep object content tree that I transform into a XML using JAXB and a small self written API on top.

But now I want to create a static HTML site that has basically the same content (and structure) as the XML, but with tables, parts that can be collapsed, images and so on.

How can I approach this?

  • Using XSLT seems a bit "redundant" since it depends heavily on the XML and if the XML changes the XSLT will have to change as well.
  • Some kind of template engine is over the top because I only need one static site.
  • Building the HTML with a simple library like j2html hardcoding the structure and small methods for elements that are repeating.

I'm currently in favor of the last option simply because it seems the easiest and fastest way, but I'm worried that I'm shooting myself in the foot with it down the road.

  • 1
    The XSLT option seems to be the most flexible way for me, and is robust against later changes. – πάντα ῥεῖ Sep 20 at 16:09
  • 1
    Your con against XSLT doesn't seem valid. All the proposed solutions will need to change if the source XML changes. – JimmyJames Sep 20 at 20:34
  • XSLT would seem to have been designed for almost exactly this sort of problem. – Steve Sep 21 at 19:06
1

But now I want to create a static HTML site that has basically the same content (and structure) as the XML, but with tables, parts that can be collapsed, images and so on.

This seems like a basic use case for HTML, CSS stylesheets, and maybe some Javascript. Tables are basic HTML (and are so old that many people regard them as being obsolete), collapsing parts can be done with CSS and/or Javascript, and images are also basic HTML. If all you want is a web page just... make a web page?

If you want to automate turning the XML into HTML, googling "XML to HTML" turns up multiple options on the first page. Pick whichever one works for your use-case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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