diff --git a/includes/common.inc b/includes/common.inc
index 5f7cdb8..4698cda 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -249,25 +249,9 @@ function drupal_get_breadcrumb() {
 }
 
 /**
- * Returns a string containing RDF namespace declarations for use in XML and
- * XHTML output.
- */
-function drupal_get_rdf_namespaces() {
-  $xml_rdf_namespaces = array();
-
-  // Serializes the RDF namespaces in XML namespace syntax.
-  if (function_exists('rdf_get_namespaces')) {
-    foreach (rdf_get_namespaces() as $prefix => $uri) {
-      $xml_rdf_namespaces[] = 'xmlns:' . $prefix . '="' . $uri . '"';
-    }
-  }
-  return count($xml_rdf_namespaces) ? "\n  " . implode("\n  ", $xml_rdf_namespaces) : '';
-}
-
-/**
  * Add output to the head tag of the HTML page.
  *
- * This function can be called as long the headers aren't sent. Pass no
+ * This function can be called as long as the headers aren't sent. Pass no
  * arguments (or NULL for both) to retrieve the currently stored elements.
  *
  * @param $data
diff --git a/includes/theme.inc b/includes/theme.inc
index bea87c0..a23b25a 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -2345,13 +2345,14 @@ function template_preprocess_html(&$variables) {
     $variables['classes_array'][] = drupal_html_class('node-type-' . $node->type);
   }
 
-  // RDFa allows annotation of XHTML pages with RDF data, while GRDDL provides
-  // mechanisms for extraction of this RDF content via XSLT transformation
-  // using an associated GRDDL profile.
-  $variables['rdf_namespaces']    = drupal_get_rdf_namespaces();
-  $variables['grddl_profile']     = 'http://www.w3.org/1999/xhtml/vocab';
-  $variables['language']          = $GLOBALS['language'];
-  $variables['language']->dir     = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
+  // Initializes attributes which are specific to the html and body elements.
+  $variables['html_attributes_array'] = array();
+  $variables['body_attributes_array'] = array();
+
+  // HTML element attributes.
+  $variables['html_attributes_array']['xmlns'] = "http://www.w3.org/1999/xhtml";
+  $variables['html_attributes_array']['xml:lang'] = $GLOBALS['language']->language;
+  $variables['html_attributes_array']['dir'] = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
 
   // Add favicon.
   if (theme_get_setting('toggle_favicon')) {
@@ -2480,6 +2481,10 @@ function template_process_page(&$variables) {
  * @see html.tpl.php
  */
 function template_process_html(&$variables) {
+  // Flatten out html_attributes and body_attributes.
+  $variables['html_attributes'] = drupal_attributes($variables['html_attributes_array']);
+  $variables['body_attributes'] = drupal_attributes($variables['body_attributes_array']);
+
   // Render page_top and page_bottom into top level variables.
   $variables['page_top'] = drupal_render($variables['page']['page_top']);
   $variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);
diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module
index ebecd42..1a29646 100644
--- a/modules/rdf/rdf.module
+++ b/modules/rdf/rdf.module
@@ -461,6 +461,18 @@ function rdf_process(&$variables, $hook) {
 }
 
 /**
+ * Implements MODULE_preprocess_HOOK()
+ */
+function rdf_preprocess_html(&$variables) {
+  // Adds RDF namespace prefix bindings in the form of an RDFa 1.1 prefix
+  // attribute inside the html element.
+  $prefixes = array();
+  foreach(rdf_get_namespaces() as $prefix => $uri) {
+    $variables['html_attributes_array']['prefix'][] = $prefix . ': ' . $uri . "\n";
+  }
+}
+
+/**
  * Implements MODULE_preprocess_HOOK().
  */
 function rdf_preprocess_node(&$variables) {
diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test
index 7586235..50177ca 100644
--- a/modules/rdf/rdf.test
+++ b/modules/rdf/rdf.test
@@ -713,3 +713,48 @@ class RdfGetRdfNamespacesTestCase extends DrupalWebTestCase {
     $this->assertTrue(!isset($ns['dc']), t('A prefix with conflicting namespaces is discarded.'));
   }
 }
+
+/**
+ * Tests for RDF namespaces XML serialization.
+ */
+class DrupalGetRdfNamespacesTestCase extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'RDF namespaces serialization test',
+      'description' => 'Confirm that the serialization of RDF namespaces in present in the HTML markup.',
+      'group' => 'RDF',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('rdf', 'rdf_test');
+  }
+
+  /**
+   * Test RDF namespaces.
+   */
+  function testGetRdfNamespaces() {
+    // Fetches the front page and extracts RDFa 1.1 prefixes.
+    $this->drupalGet('');
+
+    $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', array(
+      ':prefix_binding' => 'rdfs: http://www.w3.org/2000/01/rdf-schema#',
+    ));
+    $this->assertTrue(!empty($element), t('A prefix declared once is displayed.'));
+
+    $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', array(
+      ':prefix_binding' => 'foaf: http://xmlns.com/foaf/0.1/',
+    ));
+    $this->assertTrue(!empty($element), t('The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.'));
+
+    $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', array(
+      ':prefix_binding' => 'foaf1: http://xmlns.com/foaf/0.1/',
+    ));
+    $this->assertTrue(!empty($element), t('Two prefixes can be assigned the same namespace.'));
+
+    $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', array(
+      ':prefix_binding' => 'dc: ',
+    ));
+    $this->assertTrue(empty($element), t('A prefix with conflicting namespaces is discarded.'));
+  }
+}
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index 9b70bf1..c9cd39f 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -2389,38 +2389,6 @@ class DrupalJSONTest extends DrupalUnitTestCase {
 }
 
 /**
- * Tests for RDF namespaces XML serialization.
- */
-class DrupalGetRdfNamespacesTestCase extends DrupalWebTestCase {
-  public static function getInfo() {
-    return array(
-      'name' => 'RDF namespaces XML serialization tests',
-      'description' => 'Confirm that the serialization of RDF namespaces via drupal_get_rdf_namespaces() is output and parsed correctly in the XHTML document.',
-      'group' => 'System',
-    );
-  }
-
-  function setUp() {
-    parent::setUp('rdf', 'rdf_test');
-  }
-
-  /**
-   * Test RDF namespaces.
-   */
-  function testGetRdfNamespaces() {
-    // Fetches the front page and extracts XML namespaces.
-    $this->drupalGet('');
-    $xml = new SimpleXMLElement($this->content);
-    $ns = $xml->getDocNamespaces();
-
-    $this->assertEqual($ns['rdfs'], 'http://www.w3.org/2000/01/rdf-schema#', t('A prefix declared once is displayed.'));
-    $this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', t('The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.'));
-    $this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', t('Two prefixes can be assigned the same namespace.'));
-    $this->assertTrue(!isset($ns['dc']), t('A prefix with conflicting namespaces is discarded.'));
-  }
-}
-
-/**
  * Basic tests for drupal_add_feed().
  */
 class DrupalAddFeedTestCase extends DrupalWebTestCase {
diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test
index 7c68989..b67a879 100644
--- a/modules/simpletest/tests/theme.test
+++ b/modules/simpletest/tests/theme.test
@@ -451,3 +451,31 @@ class ThemeHtmlTag extends DrupalUnitTestCase {
     $this->assertEqual('<title>title test</title>'."\n", theme_html_tag($tag), t('Test title tag generation.'));
   }
 }
+
+/**
+ * Functional test for attributes of html.tpl.php.
+ */
+class ThemeHtmlTplPhpAttributesTest extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'html.tpl.php html and body attributes',
+      'description' => 'Tests attributes inserted in the html and body elements of html.tpl.php.',
+      'group' => 'Theme',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('theme_test');
+  }
+
+  /**
+   * Test that the theme system can generate output when called by hook_init().
+   */
+  function testThemeInitializationHookInit() {
+    $this->drupalGet('');
+    $attributes = $this->xpath('/html[@theme_test_html_attribute="theme test html attribute value"]');
+    $this->assertTrue(count($attributes) == 1, t('Attribute set in the html element via MODULE_preprocess_HOOK() found.'));
+    $attributes = $this->xpath('/html/body[@theme_test_body_attribute="theme test body attribute value"]');
+    $this->assertTrue(count($attributes) == 1, t('Attribute set in the body element via MODULE_preprocess_HOOK() found.'));
+  }
+}
diff --git a/modules/simpletest/tests/theme_test.module b/modules/simpletest/tests/theme_test.module
index 160d192..b46d9b1 100644
--- a/modules/simpletest/tests/theme_test.module
+++ b/modules/simpletest/tests/theme_test.module
@@ -104,3 +104,11 @@ function _theme_test_suggestion() {
 function theme_test_preprocess_breadcrumb(&$variables) {
   $variables['theme_test_preprocess_breadcrumb'] = 1;
 }
+
+/**
+ * Implements MODULE_preprocess_HOOK()
+ */
+function theme_test_preprocess_html(&$variables) {
+  $variables['html_attributes_array']['theme_test_html_attribute'] = 'theme test html attribute value';
+  $variables['body_attributes_array']['theme_test_body_attribute'] = 'theme test body attribute value';
+}
diff --git a/modules/system/html.tpl.php b/modules/system/html.tpl.php
index 0e01277..de56db1 100644
--- a/modules/system/html.tpl.php
+++ b/modules/system/html.tpl.php
@@ -9,7 +9,8 @@
  * - $css: An array of CSS files for the current page.
  * - $language: (object) The language the site is being displayed in.
  *   $language->language contains its textual representation.
- *   $language->dir contains the language direction. It will either be 'ltr' or 'rtl'.
+ *   $language->dir contains the language direction.
+ *   It will either be 'ltr' or 'rtl'.
  * - $rdf_namespaces: All the RDF namespace prefixes used in the HTML document.
  * - $grddl_profile: A GRDDL profile allowing agents to extract the RDF data.
  * - $head_title: A modified version of the page title, for use in the TITLE
@@ -40,22 +41,20 @@
  * @see template_preprocess_html()
  * @see template_process()
  */
-?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
-  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>"<?php print $rdf_namespaces; ?>>
-
-<head profile="<?php print $grddl_profile; ?>">
-  <?php print $head; ?>
-  <title><?php print $head_title; ?></title>
-  <?php print $styles; ?>
-  <?php print $scripts; ?>
-</head>
-<body class="<?php print $classes; ?>" <?php print $attributes;?>>
-  <div id="skip-link">
-    <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a>
-  </div>
-  <?php print $page_top; ?>
-  <?php print $page; ?>
-  <?php print $page_bottom; ?>
-</body>
+?><!DOCTYPE html>
+<html<?php print $html_attributes; ?>>
+  <head>
+    <?php print $head; ?>
+    <title><?php print $head_title; ?></title>
+    <?php print $styles; ?>
+    <?php print $scripts; ?>
+  </head>
+  <body class="<?php print $classes; ?>" <?php print $body_attributes;?>>
+    <div id="skip-link">
+      <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a>
+    </div>
+    <?php print $page_top; ?>
+    <?php print $page; ?>
+    <?php print $page_bottom; ?>
+  </body>
 </html>
