Creating a static HTML site from XML content

I have a long XML document from which I need to create static HTML pages (for distribution via CD). I know (to varying degrees) JavaScript, PHP, and Python. The current options that I reviewed are listed here:

  • I do not rule out JavaScript, so one option would be to use ajax to dynamically load XML content into HTML pages. Edit: I would use jQuery for this option.

  • Explore the basic XSLT and create HTML for the correct specification in this way.

  • Create a site using PHP (for example), and then create a static site.

  • Write a script (e.g. in Python) to convert XML to HTML. This is similar to the XSLT variant, but without learning XSLT.

Helpful information:

  • XML is likely to change at some point, so I would like to easily restore the site.

  • I need to create some kind of menu to navigate through the document (so I will need to create some kind of content index).

I would like to know if anyone has any better ideas that I haven't thought about. If not, I would like you to tell me which of my options seems the most reasonable. I think I know what I'm going to do, but I would like a second opinion. Thank.

+3
source share
4 answers

I think XSLT is by far the easiest and best method - even taking into account the need to learn xslt.

xslt, - "push-", , , XML- html. , html . :

<xsl:template match="/" > <!-- "/" matches the document root -->
  <html>  <!-- whatever is not in xsl: namespace is template output -->
  <head><title>...</title></head>
  <body>
  <xsl:apply-templates />  <!-- this searches for and calls additional template matches --> 
  </body>
  </html>
</xsl:template>  
+4

XSLT, , XML. XML.

+2

PHP. , XML , "" PHP.

Python script , javascript - ( , ).

Use server languages ​​for these tasks, this is what they were made for.

+1
source

Go with what you are most comfortable with.

If you just can use (for example) php to create a page, then use a script command line (in python or php) to create cached files for you.

0
source

Source: https://habr.com/ru/post/1745817/


All Articles