HTML5 and Composite C1

Topics: Feature requests, General, Visual editor
Mar 3, 2011 at 10:59 PM

Is is recommended to use HTML5 with Composite C1?

If I'm not mistaken, XSLT templates require XML... so you'd have to serve xHTML5... and as far as I can gather, IE doesn't do XHTML5.

Am I totally off base, here?

Coordinator
Mar 4, 2011 at 12:22 AM
Edited Mar 4, 2011 at 12:23 AM

We have the folllowing known issues with html5

  • the SEO assistant will not locate keywords wrapped in html5 specific elements
  • the visual html editor does not support html5 specific elements

You should be good to go with html 5 if you can live without the SEO assistant (for now) and your users are not required to build up html 5 based page content in the WYSIWYG editor.

Your layout templates, XSLTs, Web Forms, MVC views etc. can emit html 5 just fine.

AFAIK html 5 documents can be both 'XML' and 'sloppy' so the fact that Composite C1 is 'XML' should not be a problem. You should be able to get there by just adding the doctype and then use the tags you want.

If you find more html5 issues than the two listed above, please post about it.

Mar 4, 2011 at 4:28 PM

I assume you mean the standard HTML DOCTYPE, <!DOCTYPE html>

Instead of this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://www.composite.net/ns/function/1.0" xmlns:lang="http://www.composite.net/ns/localization/1.0" xmlns:rendering="http://www.composite.net/ns/rendering/1.0" xmlns:asp="http://www.composite.net/ns/asp.net/controls">

For HTML5:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://www.composite.net/ns/function/1.0" xmlns:lang="http://www.composite.net/ns/localization/1.0" xmlns:rendering="http://www.composite.net/ns/rendering/1.0" xmlns:asp="http://www.composite.net/ns/asp.net/controls">

Mar 11, 2011 at 7:17 PM

I noticed that when you remove the XML Namespace xmlns="http://www.w3.org/1999/xhtml" from the <html> tag, the composite system doesn't seem to recognize the layout and no server side stuff is done.

HTML5 doesn't require the xmlns because HTML5 is by default in that namespace. This is what I have and it works:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://www.composite.net/ns/function/1.0" xmlns:lang="http://www.composite.net/ns/localization/1.0" xmlns:rendering="http://www.composite.net/ns/rendering/1.0" xmlns:asp="http://www.composite.net/ns/asp.net/controls">

 

It would be really nice to see a list of gotchas when it comes to HTML5 and Composite C1

Mar 11, 2011 at 7:43 PM

Since the rendering of all our C1 websites is done through the use of ASP.NET Master Pages we don't have this problem. But it should be an easy fix to attach a Filter that will remove the namespace from the <html> tag before the content is sent to the client.

  • Create a class that inherits from Stream 
  • Overwrite its Write-method and do a seach&replace on the html-tag
  • In global.asax you subscribe to the PostHandlerExecuteRequest event of the HttpApplication instance
  • Make sure the current handler is the composite page class
  • Attach your own stream-class to Response.Filter

http://msdn.microsoft.com/en-us/library/system.web.httpresponse.filter.aspx

Mar 11, 2011 at 8:11 PM

Yeah, it's not a huge deal, just interesting.

How did you find the transition to using Master Pages? This is a pattern that I'm definitely used to, and I've seen some documentation on it here, but were there many roadblocks that you ran into?

Were there things that didn't work in the Composite C1 ecosystem?

Would love to see any references that you used.

Mar 11, 2011 at 8:17 PM
Edited Mar 11, 2011 at 8:23 PM

well, im the one behind http://compositec1contrib.codeplex.com/ so i would love to hear if you're having problems using it.

Using Master Pages is very simple and the implementation in CompositeC1Contrib simply relies on a .master file being present with the same name as the Template in C1. If its not there, it will default back to using normal XLST Template rendering so the two methods can easily co-exist. 

Hopefully this will make into C1 very soon... 2.1 just had to get out the door with the scheduled features so we can look forward on new exciting stuff. A pure MVC rendering engine is also on the drawing board.

Apr 14, 2011 at 12:18 PM

Should we have a separate topic for html5? There are a few small things (or not so small) we've come across so far, and it might be good to segment it all off?