Search

Is anyone developing in Symphony with HTML5?

I’m wondering whether anyone has a solution for being able to indent XML plus use HTML 5. According to Content with Style, there are some problems with XSLT and HTML 5.

I have been able to create an HTML 5 Doctype with the following output instruction:

<xsl:output
    method="html"
    doctype-public="XSLT-compat"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

Unfortunately, there is no indenting. It seems method="html" defaults to returns, but no indenting. But using method="xml" does output with indenting, however, there is an empty attribute string for the missing doctype-system attribute.

I’d be curious to hear if someone had created a solution for this. There are a lot of things in (X)HTML5 that I am looking forward to playing around with, such as HTML5 Video.

I’ve actually run into this problem too; is there any way we can get a “clean” HTML5 doc-type (meaning, just <!DOCTYPE html>) and is there any way we can get indentation?

Unfortunately, XHTML2 seems to be dead, so it’s either HTML5 or stick to an old standard. XHTML5 seems like a bad idea in terms of compatibility (IE6 will choke, maybe some other browsers), but regardless, it’d be nice if we could get support for that too.

I was just re-reading the whole ‘Xhtml as text/html considered harmful’ bugaboo last night, so it’s funny you mention this now. To me, it seems pretty hypocritical of Hixie to accuse xhtml of not following the Robustness Principle, claim to be ‘paving the cowpaths’ then also invalidate the only practical way to transmit xml-based markup to Explorer. I guess he’s just an xml-hater. Possibly we could implement an extension that would limit invalid transmission to explorer as this solution does.

Would like some advice and delve in too. Embedding videos with sublimevideo and building I-ads seems just like one of many really cool posibilities.

I’ve found that using doctype-public=”XSLT-compat” causes various HTML5 validators to fail. Instead I’ve opted to do this in my master.xsl template:

<xsl:output method="html"
media-type="text/html"
omit-xml-declaration="yes"
encoding="UTF-8"
indent="yes" 
extension-element-prefixes="exsl"/>

In my root template I put this:

<xsl:text disable-output-escaping="yes">&lt;</xsl:text>!DOCTYPE html<xsl:text disable-output-escaping="yes">&gt;</xsl:text>

You can see an example of this in action on here

Personally, I plan on using HTML5 with XHTML syntax. Despite was Hixie and Google advocate. The nice thing about HTML5 is you can write it as XHTML if you want to.

Here’s hoping there’s a solution to get XSLT to output HTML5.

[edit:]
I just did some Googling and it sounds like there are some serious compatibility issues with HTML5 and XSLT 1.0. However, no one mentions XSLT 2.0 and whether or not that proposed spec would solve any of the issues.

I was able to parse fully valid HTML5 with this XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" omit-xml-declaration="yes" indent="yes" />

<xsl:variable name="is-logged-in" select="/data/events/login-info/@logged-in"/>

<xsl:template match="/">
    <xsl:text disable-output-escaping="yes">&lt;</xsl:text>!DOCTYPE html<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
    <html lang="en">
        <head>
            <meta charset="utf-8" />
            <!-- I removed the title, CSS links, fav icon links, ect. to keep this short. -->
        </head>
        <body>
            <!-- I removed the normal page content to keep this short. -->
        </body>
    </html>
</xsl:template>

</xsl:stylesheet>

I ran it through a few different validators and all I got back was a warning saying I should be careful using the spec as it’s unfinished.

My guess is that HTML5 will be fine as long as we continue to use XHTML syntax (which is valid under HTML5 anyway). The above method isn’t perfect, it’s more of a work-around, but it generates valid HTML5 and allows us to start playing with the next version of the tech.

Can anyone think of anything else that is likely to cause a problem?

@bauhouse:

Unfortunately, there is no indenting. It seems method=”html” defaults to returns, but no indenting.

AFAIK, this is a glitch in LibXSLT. It should output indented code if the indent attribute’s value is yes. But it doesn’t.

Can anyone think of anything else that is likely to cause a problem?

As I understand it (and I’m not sure I totally do) We’re in a bit of a catch-22, because valid use of the xhtml serialization of html5 requires sending responses as ‘application/xhtml+xml’ , which <= IE8 chokes on.

which <= IE8 chokes on

Ah, an issue with IE? What else is new?

Well, ludicrously shameful css rendering is one thing, but it won’t render a doc delivered as ‘application/xhtml+xml’ at all.

The XML declaration, for example, has been a show-stopper on IE6 and (AFAIK) on IE7. There are serious HTML form bugs with button values in IE6 and IE7 (which you may google). Plus, there is all this hassle with CSS rendering. (Not to speak of IE5 and 5.5, which were absolute nightmares for many years.) The truth is: They will never build a browser that can catch up. Never ever. Because their motivation is market share, not quality. And: they look for “features” instead of doing things right from the beginning. I wish IE a sudden death.

As I understand it (and I’m not sure I totally do) We’re in a bit of a catch-22, because valid use of the xhtml serialization of html5 requires sending responses as ‘application/xhtml+xml’ , which <= IE8 chokes on.

That may be true but there’s nothing to stop us from using normal XHTML syntax. I know many of the examples show people using HTML4 syntax but that’s mostly because of politics and not because it’s better.

Though, I have seen Google make the argument that you shouldn’t close your tags because it “makes the documents less confusing and significantly lowers your file size,” which I feel is an extremely weak reason.

If you want to use the text/html serialization of HTML5 and continue to use XHTML syntax (lower-case tags and attributes, quoting all attributes, closing all tags, ect.) you can do so. Your code will still validate.

@Michael-e: You obviously haven’t been paying attention to IE9. Current reports put it’s javascript performance just behind the webkit and Opera (the alpha versions of both) and ahead of Firefox. In it’s developer preview it’s getting around 60/100 on the Acid 3 Test and they’re hoping to get that up to around 90/100 when they launch it. It’ll also have a significant portion of HTML5 and CSS3, not to mention SVG.

They’re even planning on speeding up their release cycle to come in line with the other modern browsers like Firefox, which would put it at around every year or so.

I hate IE as much as the next guy but it’s clear they’ve gotten tired of being the worst browser on the block. IE9 looks like it’s going to be a beast and a half.

(Sorry that this is a bit off topic.)

That may be true but there’s nothing to stop us from using normal XHTML syntax.

True, except it stops us from being able to extend the document (svg, rdf, etc.) but I guess the human web just won’t be going down that road, at least not until after 2022…

RDFa is fully compatible with both HTML and XHTML (so says the W3C). The same is true of SVG (so says A List Apart). I believe most of the new pretties that we get in HTML5 work in both.

One of interesting things of HTML5 is that I can skip some closing tags. It’s possible to do that even using a XML parser?

Curious, why would you want to skip closing elements (or tags)?

Nope. You miss a tag and it screams.

That’s not something new about HTML5, it’s something that’s in HTML4 as well. It’s one of the reasons people were pushing for XHTML. People seem to forget that not closing tags can cause problems in browsers because that browser now has to guess where that element ends and where it’s supposed to be nested.

If we can’t use the xml serialization of html5, we are delivering a non-xml document, which cannot contain any xml. It has no xml or namespace declaration.

The ALA article cites this WHATWG page regarding SVG and other xml compatibility, which stipulates xhtml serialization only.

I think RDFa is trickier, from what I understand it’s up in the air. I was basing my understanding off Jenni Tennison’s summary from last summer (or August I should say, for you austral types). I believe that Hixie wanted to make up his own standard rather than use one that has an XML serialization (RDF) so that’s how ‘Microdata’ was born. Fortunately (i guess?) TAG got him to spin it off into its own standard. You can read some pretty heated emails about it among the Elders of the Internet here.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details