Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 84)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 85)
@@ -21,6 +21,8 @@
 import java.util.PropertyResourceBundle;
 import java.net.URL;
 import java.net.MalformedURLException;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import java.sql.Connection;
 import java.sql.SQLException;
 
@@ -225,10 +227,65 @@
       String docid = ((String[])params.get("docid"))[0]; 
       String doc = docreader.readXMLDocument((new Long(docid)).longValue());
 
-      // set content type and other response header fields first
-      response.setContentType("text/xml");
+
+      String qformat = ((String[])params.get("qformat"))[0]; 
+      if (qformat.equals("xml")) {
+        // set content type and other response header fields first
+        response.setContentType("text/xml");
+        out.println(doc);
+      } else if (qformat.equals("html")) {
+        // set content type and other response header fields first
+        response.setContentType("text/html");
+        //out.println("Converting to HTML...");
+        XMLDocumentFragment htmldoc = null;
+
+        // Look up the System ID of the XSL sheet
+        PreparedStatement pstmt;
+        String xsl_system_id = null;
   
-      out.println(doc);
+        try {
+          pstmt =
+            conn.prepareStatement("SELECT system_id " +
+                    "FROM xml_catalog_entities " +
+                    "WHERE source_doctype LIKE ? " +
+                    "AND target_doctype LIKE ?");
+          // Bind the values to the query
+          pstmt.setString(1, "-//NCEAS//eml-dataset//EN");
+          pstmt.setString(2, "-//W3C//HTML//EN");
+  
+          pstmt.execute();
+          try {
+            ResultSet rs = pstmt.getResultSet();
+            try {
+              boolean tableHasRows = rs.next();
+              if (tableHasRows) {
+                try {
+                  xsl_system_id = rs.getString(1);
+                } catch (SQLException e) {
+                  System.out.println("Error with getString: " + e.getMessage());
+                }
+              }
+            } catch (SQLException e) {
+              System.out.println("Error with next: " + e.getMessage());
+            }
+          } catch (SQLException e) {
+            System.out.println("Error with getrset: " + e.getMessage());
+          }
+          pstmt.close();
+        } catch (SQLException e) {
+          System.out.println("Error getting id: " + e.getMessage());
+        }
+ 
+        // Try to apply the style
+        try {
+          XSLStylesheet style = new XSLStylesheet(new URL(xsl_system_id), null);
+          htmldoc = (new XSLProcessor()).processXSL(style, 
+                     (Reader)(new StringReader(doc)),null);
+          htmldoc.print(out);
+        } catch (Exception e) {
+          out.println("Error transforming document:\n" + e.getMessage());
+        }
+      }
   }
 
   /** 
Index: xsqltest/eml-dataset-display.xsl
===================================================================
--- xsqltest/eml-dataset-display.xsl	(revision 84)
+++ xsqltest/eml-dataset-display.xsl	(revision 85)
@@ -22,7 +22,7 @@
   <xsl:template match="/">
     <html>
       <head>
-        <link rel="stylesheet" type="text/css" href="./rowcol.css" />
+        <link rel="stylesheet" type="text/css" href="/xmltodb/xsqltest/rowcol.css" />
       </head>
       <body class="emlbody">
         <center>
@@ -164,4 +164,4 @@
   <xsl:template match="keyword_info"/>
   <xsl:template match="relations"/>
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
Index: MetaCatServlet.java
===================================================================
--- MetaCatServlet.java	(revision 84)
+++ MetaCatServlet.java	(revision 85)
@@ -21,6 +21,8 @@
 import java.util.PropertyResourceBundle;
 import java.net.URL;
 import java.net.MalformedURLException;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import java.sql.Connection;
 import java.sql.SQLException;
 
@@ -225,10 +227,65 @@
       String docid = ((String[])params.get("docid"))[0]; 
       String doc = docreader.readXMLDocument((new Long(docid)).longValue());
 
-      // set content type and other response header fields first
-      response.setContentType("text/xml");
+
+      String qformat = ((String[])params.get("qformat"))[0]; 
+      if (qformat.equals("xml")) {
+        // set content type and other response header fields first
+        response.setContentType("text/xml");
+        out.println(doc);
+      } else if (qformat.equals("html")) {
+        // set content type and other response header fields first
+        response.setContentType("text/html");
+        //out.println("Converting to HTML...");
+        XMLDocumentFragment htmldoc = null;
+
+        // Look up the System ID of the XSL sheet
+        PreparedStatement pstmt;
+        String xsl_system_id = null;
   
-      out.println(doc);
+        try {
+          pstmt =
+            conn.prepareStatement("SELECT system_id " +
+                    "FROM xml_catalog_entities " +
+                    "WHERE source_doctype LIKE ? " +
+                    "AND target_doctype LIKE ?");
+          // Bind the values to the query
+          pstmt.setString(1, "-//NCEAS//eml-dataset//EN");
+          pstmt.setString(2, "-//W3C//HTML//EN");
+  
+          pstmt.execute();
+          try {
+            ResultSet rs = pstmt.getResultSet();
+            try {
+              boolean tableHasRows = rs.next();
+              if (tableHasRows) {
+                try {
+                  xsl_system_id = rs.getString(1);
+                } catch (SQLException e) {
+                  System.out.println("Error with getString: " + e.getMessage());
+                }
+              }
+            } catch (SQLException e) {
+              System.out.println("Error with next: " + e.getMessage());
+            }
+          } catch (SQLException e) {
+            System.out.println("Error with getrset: " + e.getMessage());
+          }
+          pstmt.close();
+        } catch (SQLException e) {
+          System.out.println("Error getting id: " + e.getMessage());
+        }
+ 
+        // Try to apply the style
+        try {
+          XSLStylesheet style = new XSLStylesheet(new URL(xsl_system_id), null);
+          htmldoc = (new XSLProcessor()).processXSL(style, 
+                     (Reader)(new StringReader(doc)),null);
+          htmldoc.print(out);
+        } catch (Exception e) {
+          out.println("Error transforming document:\n" + e.getMessage());
+        }
+      }
   }
 
   /** 
Index: lib/resultset.xsl
===================================================================
--- lib/resultset.xsl	(revision 84)
+++ lib/resultset.xsl	(revision 85)
@@ -29,8 +29,18 @@
           </h3>
         </center>
         
+        <form action="/servlets/MetaCatServlet" method="POST">
+        <input type="hidden" name="action" value="getdocument"/>
+
+        <xsl:text>Output Format: </xsl:text>
+        <select name="qformat">
+          <option value="html">HTML</option>
+          <option value="xml">XML</option>
+        </select>
+
         <table width="100%">
         <tr class="rowodd">
+        <th>&nbsp;</th>
         <th><xsl:text>Document ID</xsl:text></th>
         <th><xsl:text>Title</xsl:text></th>
         </tr>
@@ -44,17 +54,30 @@
               </xsl:choose>
             </xsl:attribute>
 
-          <td><a>
+          <td>
+              <input type="radio" name="docid">
+                <xsl:attribute name="value">
+                  <xsl:value-of select="."/>
+                </xsl:attribute>
+              </input>
+              <input type="submit" value="Display"/>
+       <!--
+              <a>
               <xsl:attribute name="href">
               /servlets/MetaCatServlet?action=getdocument&amp;docid=<xsl:value-of select="."/>
               </xsl:attribute>
               <xsl:text>Document </xsl:text><xsl:value-of select="."/>
               </a>
+        -->
           </td>
+          <td>
+              <xsl:text>Document </xsl:text><xsl:value-of select="."/>
+          </td>
           <td>Fake title</td>
           </tr>
         </xsl:for-each>
         </table>
+        </form>
 
       </body>
     </html>
Index: lib/style/resultset.xsl
===================================================================
--- lib/style/resultset.xsl	(revision 84)
+++ lib/style/resultset.xsl	(revision 85)
@@ -29,8 +29,18 @@
           </h3>
         </center>
         
+        <form action="/servlets/MetaCatServlet" method="POST">
+        <input type="hidden" name="action" value="getdocument"/>
+
+        <xsl:text>Output Format: </xsl:text>
+        <select name="qformat">
+          <option value="html">HTML</option>
+          <option value="xml">XML</option>
+        </select>
+
         <table width="100%">
         <tr class="rowodd">
+        <th>&nbsp;</th>
         <th><xsl:text>Document ID</xsl:text></th>
         <th><xsl:text>Title</xsl:text></th>
         </tr>
@@ -44,17 +54,30 @@
               </xsl:choose>
             </xsl:attribute>
 
-          <td><a>
+          <td>
+              <input type="radio" name="docid">
+                <xsl:attribute name="value">
+                  <xsl:value-of select="."/>
+                </xsl:attribute>
+              </input>
+              <input type="submit" value="Display"/>
+       <!--
+              <a>
               <xsl:attribute name="href">
               /servlets/MetaCatServlet?action=getdocument&amp;docid=<xsl:value-of select="."/>
               </xsl:attribute>
               <xsl:text>Document </xsl:text><xsl:value-of select="."/>
               </a>
+        -->
           </td>
+          <td>
+              <xsl:text>Document </xsl:text><xsl:value-of select="."/>
+          </td>
           <td>Fake title</td>
           </tr>
         </xsl:for-each>
         </table>
+        </form>
 
       </body>
     </html>
Index: lib/style/eml-dataset-display.xsl
===================================================================
--- lib/style/eml-dataset-display.xsl	(revision 84)
+++ lib/style/eml-dataset-display.xsl	(revision 85)
@@ -22,7 +22,7 @@
   <xsl:template match="/">
     <html>
       <head>
-        <link rel="stylesheet" type="text/css" href="./rowcol.css" />
+        <link rel="stylesheet" type="text/css" href="/xmltodb/xsqltest/rowcol.css" />
       </head>
       <body class="emlbody">
         <center>
@@ -164,4 +164,4 @@
   <xsl:template match="keyword_info"/>
   <xsl:template match="relations"/>
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
Index: resultset.xsl
===================================================================
--- resultset.xsl	(revision 84)
+++ resultset.xsl	(revision 85)
@@ -29,8 +29,18 @@
           </h3>
         </center>
         
+        <form action="/servlets/MetaCatServlet" method="POST">
+        <input type="hidden" name="action" value="getdocument"/>
+
+        <xsl:text>Output Format: </xsl:text>
+        <select name="qformat">
+          <option value="html">HTML</option>
+          <option value="xml">XML</option>
+        </select>
+
         <table width="100%">
         <tr class="rowodd">
+        <th>&nbsp;</th>
         <th><xsl:text>Document ID</xsl:text></th>
         <th><xsl:text>Title</xsl:text></th>
         </tr>
@@ -44,17 +54,30 @@
               </xsl:choose>
             </xsl:attribute>
 
-          <td><a>
+          <td>
+              <input type="radio" name="docid">
+                <xsl:attribute name="value">
+                  <xsl:value-of select="."/>
+                </xsl:attribute>
+              </input>
+              <input type="submit" value="Display"/>
+       <!--
+              <a>
               <xsl:attribute name="href">
               /servlets/MetaCatServlet?action=getdocument&amp;docid=<xsl:value-of select="."/>
               </xsl:attribute>
               <xsl:text>Document </xsl:text><xsl:value-of select="."/>
               </a>
+        -->
           </td>
+          <td>
+              <xsl:text>Document </xsl:text><xsl:value-of select="."/>
+          </td>
           <td>Fake title</td>
           </tr>
         </xsl:for-each>
         </table>
+        </form>
 
       </body>
     </html>
