3 ms·
> Why can't HTML some kind of templating system, or even simple includes? XHTML does, it's XSLT. For example: <?xml version='1.0' encoding='ASCII'?>
by progval 6y ago
> Why can't HTML some kind of templating system, or even simple includes?
XHTML does, it's XSLT.
For example:
<?xml version='1.0' encoding='ASCII'?>
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>
<root>
<title>Page Title</title>
<block name="main">
<article xmlns="http://www.w3.org/1999/xhtml">
<p>Hello world</p>
</article>
</block>
</root>
With this in stylesheet.xsl:
<?xml version="1.0" encoding="ASCII"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/root">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<head>
<title><xsl:value-of select="title" /></title>
</head>
<body>
<h1>My Fancy Blog</h1>
<xsl:copy-of select="block[@name='main']/xhtml:article" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
And it's supported by all major browsers. Probably even IE6.
- steren 6y agoNever again I will touch XSLT. That's how I dumped my wordpress to HTML. I regretted it. https://github.com/steren/wordpress-to-html https://github.com/steren/wordpress-to-html