docs: def html_to_cnxml(html_source, cnxml_source):
      """Transform the HTML to CNXML. We need the original CNXML content in
      order to preserve the metadata in the CNXML document.
      """
      source = _string2io(html_source)
      xml = etree.parse(source)
      cnxml = etree.parse(_string2io(cnxml_source))
      # Run the HTML to CNXML transform on it
      xml = _transform('html5-to-cnxml.xsl', xml)
      # Replace the original content element with the transformed one.
      namespaces = {'c': 'http://cnx.rice.edu/cnxml'}
      xpath = etree.XPath('//c:content', namespaces=namespaces)
      replaceable_node = xpath(cnxml)[0]
      replaceable_node.getparent().replace(replaceable_node, xml.getroot())
      # Set the content into the existing cnxml source
      return etree.tostring(cnxml)