Google Answers Logo
View Question
 
Q: Conversion of Html source code to xhtml and cascading style sheets ( Answered 5 out of 5 stars,   1 Comment )
Question  
Subject: Conversion of Html source code to xhtml and cascading style sheets
Category: Computers > Programming
Asked by: huntva-ga
List Price: $10.00
Posted: 26 Mar 2003 09:31 PST
Expires: 25 Apr 2003 10:31 PDT
Question ID: 181197
How do you convert the following html source code to include xhtml and
cascading style sheets?  Please do the actual conversion and explain
how you did it.  Thanks

<html>
<head>
<base href="http://ctep-dev.cancer.gov/camp/">

<title>Mockup of Administrative Directory Redesign</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<META  name="description" content="National Cancer Institute">
<link rel="stylesheet" type="text/css" HREF="/camp/ncimaster.css"
title="master">


</head>
<body bgcolor="#FFFFFF">

<center>
<table width="625" border="0" cellspacing="0" cellpadding="2"
bgcolor="#ffffff">
  <tr> 
    <td> 
<table width="620" border="0" cellspacing="0" cellpadding="0"
bgcolor="#ffffff">
  <tr> 
    <td colspan="2"> 
      

                <table width="620" border="0" cellspacing="0"
cellpadding="0" colspan="2">
        <tr><td width="110"><img width="110" height="72" border="0"
name="ncilogo"
                src="/camp/images/ncilogo.gif"></td><td width="520"
align="center"><span class="title">The Administrative Directory: <br>
Your Desktop Yellow Pages</span></td>

                
                </td></tr></table>
           <table border="0" cellspacing="0" cellpadding="0">
           <tr><td colspan="11"><img src="/images/spacer.gif"
height="2" width="620"><br><hr width="620" color="#0A1278"
height="3"></td></tr>
           <tr><td><table width="620" border="0" cellspacing="0"
cellpadding="0">
 <tr>
          <td bgcolor="#0000A0" height="30" class="blbar2"><a
class="nav" href="" style="text-decoration: none; color:#FFFFFF;
font-weight: bold;"><div align="center">Home</div></a></font></td>
       <td bgcolor="#ffffff"><img src="/images/spacer.gif" height="2"
width="2"></td>
	   
          <td height="30" bgcolor="#0000A0" class="blbar2"><a
class="nav2" href="" style="text-decoration: none; color:#FFFFFF;
font-weight: bold;"><div align="center">Subject
Index</div></a></font></td>
        <td bgcolor="#ffffff"><img src="/images/spacer.gif" height="2"
width="2"></td>
                
          <td bgcolor="#0000A0" height="30" class="blbar2"><a
class="nav" href="" style="text-decoration: none; color:#FFFFFF;
font-weight: bold;"><div align="center">Feedback</div></a></font></td>
        <td bgcolor="#ffffff"><img src="/images/spacer.gif" height="2"
width="2"></td>
                
          
						
             
				
         
        </tr>
                </table>

               
                </table-->
                
                <table width="620" border="0" cellspacing="0"
cellpadding="0">
                <tr><td colspan="11"><img src="/images/spacer.gif"
height="2" width="620"><br><hr width="620" color="#0A1278"
height="3"></td></tr>
                
      </table>
          </td></tr></table>
          
          
</td>
  </tr>
  <!-- services section  -->
</tr>
<tr> 

                <td valign="top" width="490" height="400"
align="right">
      <table width="490" border="0" cellspacing="0" cellpadding="0"
bgcolor="#ffffff">
        <tr> 
          <td valign="top">



<table width="620" cellpadding="2" border="0"><tr><td valign="top"><p>
 

<table width="620" border=0>
<tr>
<td valign="top" width="240">
<h3><a href="">Agreements</a></h3>
<ul>
<li>CRADAs
<li>Cooperative Agreements
<li>Other Types of Agreements
</ul>
<p>
<h3><a href="">Administrative Resource Centers</a></h3>
<ul>
<li>ARC Staff Contact Lists
</ul>
<h3><a href="">Budget/Financial Management</a></h3>
<ul>
<li>Current Year Budget
<li>NCI Factbook
<li>Gift Fund
<li>Royalties
<li>Other Financial Management Subjects
</ul>
<h3><a href="">Budget/Financial Management</a></h3>
<ul>
<li>Current Year Budget
<li>NCI Factbook
<li>Gift Fund
<li>Royalties
<li>Other Financial Management Subjects
</ul>
<h3><a href="">Building Services</a></h3>
<ul>
<li>Copy Centers
<li>Mail
<li>Maintenance
<li>Office/Lab Moves
<li>Other Building Services
</ul>
<h3><a href="">Computers</a></h3>
<ul>
<li>Computer Support
<li>Support Contracts
<li>E-mail
<li>Security
<li>Training
<li>Year 2000
</ul>
<h3><a href="">Grants</a></h3>
<ul>
<li>Grants
<li>Activities Associated with their Award
</ul>
<h3><a href="">Management Analysis</a></h3>
<ul>
<li>Delegations of Authority Handbook
<li>Forms
<li>OMB
<li>Forms Clearance
<li>Management Studies
<li>Organization Information
<li>Policy Issuances
<li>Leave Issues
<li>Records Management
<li>NCI Suggestion Program
</ul>
</td>
<td valign="top">
<p>

<p>
<h3><a href="">Organizational Links</a></h3>
<ul>
<li>Links to NCI websites
</ul>
<h3><a href="">Other Support Services</a></h3>
<ul>
<li>Support Services
<li>Guidance Not Included in other Subject Chapters
</ul>
<h3><a href="">Personnel/Human Resources</a></h3>
<ul>
<li>Recruitment
<li>Merit Promotion
<li>Classification
<li>Benefits
<li>And other personnel subjects
</ul>
<h3><a href="">Procurement Contracts</a></h3>
<ul>
<li>Contracts
<li>Written Purchase Orders
<li>And other instruments for procuring goods and services
</ul>
<h3><a href="">Property</a></h3>
<ul>
<li>Surplus Property
<li>Property Policy
<li>Property Points of Contact
<li>And training issues
</ul>
<h3><a href="">Timekeeping</a></h3>
<ul>
<li>Payroll
<li>Leave issues
<li>Listing of NCI TAIMS Systems Administrators
</ul>
<h3><a href="">Travel</a></h3>
<ul>
<li>Travel advances
<li>Currency Exchange
<li>Frequent flyers
<li>Ober United Travel
<li>Passports and visas
<li>Sponsored travel
<li>Hotel taxes
<li>Travel contracts
</ul>
</td>
</tr>
<tr>
<td>

</td>
<td>&nbsp;
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="bottom">


</td>
</tr>
</table>

<br><br>
</td></tr></table>
</td>
<td valign="top">

        <p>
        

</td>

        </tr>
                
                
      </table>
    </td>
  </tr>
        <tr> 
    <td colspan="3" height="30" valign="bottom"> 
      <table  bgcolor="#FFFFFF"  cellspacing="0" cellpadding="0"
border="0" width="620" valign="top">
        <tr> 
          <td align="center" width=620 height="20"><font
color="#ffffff" size="-2" face="arial"><hr width="620" color="#0A1278"
height="3"></td>
        </tr></table>
    </td>
  </tr>
</table>
    </td>
  </tr>
</table>
</body>


</html>
Answer  
Subject: Re: Conversion of Html source code to xhtml and cascading style sheets
Answered By: snapanswer-ga on 26 Mar 2003 14:04 PST
Rated:5 out of 5 stars
 
Below this explanation, I have pasted the converted code.  Here are
the steps I followed to comply with XHTML (Transitional):
1. Add a <!DOCTYPE> that identifies XHTML Transitional.
2. Add namespace information to the <html> tag.
3. Make sure that other tags are lower case. (Example: change META to
meta).
4. Make sure all tags have a closing tag.    (Example: <BR> becomes
<BR />).
   Other popular tags to check <img>, create </p> and </li> tags
5. Make sure attributes are in " " format.   (width=620 to
width="620")
6. Make sure attributes are in lower case.   (WIDTH becomes width)
7. Make sure tags are properly nested <table>, <tr>, <td>, <div>,
<font>, etc.
8. Added alt property to <img> tags.
9. Removed invalid colspan="2" and valign attributes from the <table>
tags
10. Test with validation at http://validator.w3.org/

Here are the steps I used to put formatting into CSS:
1.  Create <style> </style> just before the </head>
    This could be pulled into your external stylesheet if preferred.
2.  Put hr color and height in the style section.
3.  Replace nested <div> center tags with center alignment in a.nav.
4.  Removed errant </font> close tags.
5.  Removed <font> tag from bottom of page since it did not wrap any
text.
6.  Created a.nav, a.nav2 and td.blbar2 in the <style> section.
    Note that a.nav and a.nav2 seem to have the same values in your
source.
    You may want to make all references to a.nav for simplicity.

The following are excellent resources for DOCTYPE, XHTML, and CSS:
A List Apart:  "Fixing Your Site with the Write DOCTYPE"
http://www.alistapart.com/stories/doctype/

BeeandNee:  "Converting HTML documents to XHTML" by B. A. Jaison, July
2002
http://www22.brinkster.com/beeandnee/techzone/articles/htmltoxhtml.asp

DevGuru:  "XHTML Coding Rules and Syntax"
http://www.devguru.com/Technologies/xhtml/quickref/xhtml_coding_rules.html

New York Public Library:  "XHTML: Authoring Tips & Tools"
http://www.nypl.org/styleguide/xhtml/tips.html

W3 Schools:  "CSS How To"
http://www.w3schools.com/css/css_howto.asp

W3C Markup Validation Service to validate your pages
http://validator.w3.org/

Search Strategy:  Find XHTML conversion tutorials

Search Terms:  convert HTML XHTML
://www.google.com/search?q=convert+HTML+XHTML

I hope you have found this information useful and easy to understand. 
If you have any questions about this information, please do not
hesitate to post a clarification request before rating the answer.

This took a little bit of extra time due to some errors present in the
various codes for the table layout.  Ultimately, I was able to have
the code pass XHTML validation.  In addition to the description above,
I included comments in the source code to help you identify where
significant changes were made.  Below is the XHTML compliant converted
source:





<!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" lang="EN">  
<head> 
<base href="http://ctep-dev.cancer.gov/camp/" /> 
 
<title>Mockup of Administrative Directory Redesign</title> 
<meta http-equiv="Content-Type" content="text/html; 
charset=iso-8859-1" /> 
<meta  name="description" content="National Cancer Institute" /> 
<link rel="stylesheet" type="text/css" href="/camp/ncimaster.css" 
title="master" /> 

	<style type="text/css">
		body { background-color: #FFFFFF; color: #000000; 
                   font-family: Helvetica, Arial, Sans-Serif; 
                   font-size: 12pt; font-style: normal; font-weight:
normal;
                   text-decoration: none; }
            hr   { color: #0a1278; height: 3px;}
		a    { color: #551a8b; 
                   font-family: Helvetica, Arial, Sans-Serif; 
                   font-size: 12pt; font-style: normal; font-weight:
normal;
                   text-decoration: underline; }
       td.blbar2 { background-color: #0000a0; height: 30px }
        a.nav    { color:#FFFFFF; 
                     font-weight: bold;
                     text-align: center; text-decoration: none; }
        a.nav2   { color:#FFFFFF; 
                     font-weight: bold;
                     text-align: center; text-decoration: none; }

	</style>
 
 
</head> 
<body> 
 
<center> 
<table width="625" border="0" cellspacing="0" cellpadding="2" 
bgcolor="#ffffff"> 
  <tr>  
    <td>  
    <table width="620" border="0" cellspacing="0" cellpadding="0" 
bgcolor="#ffffff"> 
      <tr>  
      <td colspan="2">  
       
 
                <table width="620" border="0" cellspacing="0" 
cellpadding="0"> 
                <tr><td width="110"><img width="110" height="72"
border="0"
name="ncilogo" 
                src="/camp/images/ncilogo.gif" alt="ncilogo"
/></td><td width="520"
align="center"><span class="title">The Administrative Directory: <br
/>
Your Desktop Yellow Pages</span></td> 
 
                 
<!-- this appears to be a stray                </td>  -->
</tr></table> 

<!-- in these sections there are closing font tags, but no open font
tag.  Removed -->
           <table border="0" cellspacing="0" cellpadding="0"> 
           <tr><td colspan="11"><img src="/images/spacer.gif" 
height="2" width="620" alt=" " /><br /><hr width="620" /></td></tr> 
           <tr><td><table width="620" border="0" cellspacing="0" 
cellpadding="0"> 
 <tr> 
          <td class="blbar2"><a 
class="nav" href="">Home</a></td> 
       <td bgcolor="#ffffff"><img src="/images/spacer.gif" height="2"
width="2" alt=" " /></td> 
     
          <td class="blbar2"><a 
class="nav2" href="">Subject 
Index</a></td> 
        <td bgcolor="#ffffff"><img src="/images/spacer.gif" height="2"
width="2" alt=" " /></td> 
                 
          <td class="blbar2"><a 
class="nav" href="">Feedback</a></td> 
        <td bgcolor="#ffffff"><img src="/images/spacer.gif" height="2"
width="2" alt=" " /></td> 
                 
           
       
              
     
          
        </tr> 
                </table> 
 
<!-- not sure what to make of this closing table tag with with closing
comment mark -->
<!-- decided to remove the two dahes to make it a closing table tag   
             -->
<!-- also added closing td and tr tags so that tags nest properly     
             -->
              </td></tr>       
                </table>
                 
                <table width="620" border="0" cellspacing="0" 
cellpadding="0"> 
                <tr><td colspan="11"><img src="/images/spacer.gif" 
height="2" width="620" alt=" " /><br /><hr width="620" /></td></tr> 
                 
      </table> 
          </td></tr></table> 
           
           
</td> 
  </tr> 
  <!-- services section  --> 

<!-- Validator says the following closing tag was not opened -->
<!-- </tr> --> 
<tr>  
 
                <td valign="top" width="490" height="400" 
align="right"> 
      <table width="490" border="0" cellspacing="0" cellpadding="0" 
bgcolor="#ffffff"> 
        <tr>  
          <td valign="top"> 
 
 
 
<table width="620" cellpadding="2" border="0"><tr><td valign="top"><p>
</p>
  
 
<table width="620" border="0"> 
<tr> 
<td valign="top" width="240"> 
<h3><a href="">Agreements</a></h3> 
<ul> 
<li>CRADAs</li>
<li>Cooperative Agreements</li>
<li>Other Types of Agreements</li>
</ul> 
<p>  </p> 
<h3><a href="">Administrative Resource Centers</a></h3> 
<ul> 
<li>ARC Staff Contact Lists</li>
</ul> 
<h3><a href="">Budget/Financial Management</a></h3> 
<ul> 
<li>Current Year Budget</li>
<li>NCI Factbook</li>
<li>Gift Fund</li>
<li>Royalties</li> 
<li>Other Financial Management Subjects</li>
</ul> 
<h3><a href="">Budget/Financial Management</a></h3> 
<ul> 
<li>Current Year Budget</li>
<li>NCI Factbook</li>
<li>Gift Fund</li>
<li>Royalties</li>
<li>Other Financial Management Subjects</li> 
</ul> 
<h3><a href="">Building Services</a></h3> 
<ul> 
<li>Copy Centers</li>
<li>Mail</li>
<li>Maintenance</li> 
<li>Office/Lab Moves</li> 
<li>Other Building Services</li> 
</ul> 
<h3><a href="">Computers</a></h3> 
<ul> 
<li>Computer Support</li>
<li>Support Contracts</li>
<li>E-mail</li>
<li>Security</li>
<li>Training</li>
<li>Year 2000</li>
</ul> 
<h3><a href="">Grants</a></h3> 
<ul> 
<li>Grants</li>
<li>Activities Associated with their Award</li>
</ul> 
<h3><a href="">Management Analysis</a></h3> 
<ul> 
<li>Delegations of Authority Handbook</li>
<li>Forms</li>
<li>OMB</li>
<li>Forms Clearance</li> 
<li>Management Studies</li>
<li>Organization Information</li> 
<li>Policy Issuances</li> 
<li>Leave Issues</li>
<li>Records Management</li> 
<li>NCI Suggestion Program</li>
</ul> 
</td> 
<td valign="top"> 
<p> </p>
 
<p> </p>
<h3><a href="">Organizational Links</a></h3> 
<ul> 
<li>Links to NCI websites</li> 
</ul> 
<h3><a href="">Other Support Services</a></h3> 
<ul> 
<li>Support Services</li>
<li>Guidance Not Included in other Subject Chapters</li> 
</ul> 
<h3><a href="">Personnel/Human Resources</a></h3> 
<ul> 
<li>Recruitment</li>
<li>Merit Promotion</li>
<li>Classification</li>
<li>Benefits</li>
<li>And other personnel subjects</li> 
</ul> 
<h3><a href="">Procurement Contracts</a></h3> 
<ul> 
<li>Contracts</li>
<li>Written Purchase Orders</li> 
<li>And other instruments for procuring goods and services</li> 
</ul> 
<h3><a href="">Property</a></h3> 
<ul> 
<li>Surplus Property</li>
<li>Property Policy</li>
<li>Property Points of Contact</li>
<li>And training issues</li>
</ul> 
<h3><a href="">Timekeeping</a></h3> 
<ul> 
<li>Payroll</li>
<li>Leave issues</li> 
<li>Listing of NCI TAIMS Systems Administrators</li> 
</ul> 
<h3><a href="">Travel</a></h3> 
<ul> 
<li>Travel advances</li>
<li>Currency Exchange</li>
<li>Frequent flyers</li>
<li>Ober United Travel</li>
<li>Passports and visas</li>
<li>Sponsored travel</li>
<li>Hotel taxes</li>
<li>Travel contracts</li> 
</ul> 
</td> 
</tr> 
<tr> 
<td> 
 
</td> 
<td>&nbsp; 
</td> 
</tr> 
<tr> 
<td>&nbsp;</td> 
<td valign="bottom"> 
 
 
</td> 
</tr> 
</table> 
 
<br /><br /> 
</td></tr></table> 
</td> 
<td valign="top"> 
 
        <p> </p>
         
 
</td> 
 
        </tr> 
                 
                 
      </table> 
    </td> 
  </tr> 
        <tr>  
    <td colspan="3" height="30" valign="bottom">  


<!-- Removed valign attribute from this table tag, not valid for
table, is valid for td -->
      <table  bgcolor="#FFFFFF"  cellspacing="0" cellpadding="0" 
border="0" width="620"> 
        <tr>  
          <td align="center" width="620" height="20"><hr width="620"
/></td>
        </tr></table> 
    </td> 
  </tr> 
</table> 

<!-- The validator says the following closing tags do match any open
tags -->
<!--    </td>  -->
<!--  </tr>    -->
<!-- </table>  -->

</center>
</body> 
 
 
</html>
huntva-ga rated this answer:5 out of 5 stars and gave an additional tip of: $2.00
This is an excellent answer.  Thank you so much.  RS

Comments  
Subject: Re: Conversion of Html source code to xhtml and cascading style sheets
From: snapanswer-ga on 26 Mar 2003 18:40 PST
 
I am happy that this answer is useful to you.  Thank you for the tip!

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy