Project

General

Profile

« Previous | Next » 

Revision 86

Added by Matt Jones over 24 years ago

added XSL formatting to document display for metacat servlet

View differences:

MetaCatServlet.java
170 170
      Hashtable nodelist = null;
171 171
      String query = ((String[])params.get("query"))[0]; 
172 172
      if (queryobj != null) {
173
        nodelist = queryobj.findRootNodes(query);
173
        nodelist = queryobj.findDocuments(query);
174 174
      } else {
175 175
        out.println("Query Object Init failed.");
176 176
	/*
......
247 247
          pstmt =
248 248
            conn.prepareStatement("SELECT system_id " +
249 249
                    "FROM xml_catalog_entities " +
250
                    "WHERE source_doctype LIKE ? " +
250
                    "WHERE source_doctype LIKE " +
251
                    "  (SELECT doctype from xml_documents " +
252
                    "    WHERE docid = ? ) " +
251 253
                    "AND target_doctype LIKE ?");
252 254
          // Bind the values to the query
253
          pstmt.setString(1, "-//NCEAS//eml-dataset//EN");
255
          //pstmt.setString(1, "-//NCEAS//eml-dataset//EN");
256
          pstmt.setLong(1, new Long(docid).longValue());
254 257
          pstmt.setString(2, "-//W3C//HTML//EN");
255 258
  
256 259
          pstmt.execute();
......
276 279
          System.out.println("Error getting id: " + e.getMessage());
277 280
        }
278 281
 
282
        //out.println(xsl_system_id);
283

  
279 284
        // Try to apply the style
280 285
        try {
281 286
          XSLStylesheet style = new XSLStylesheet(new URL(xsl_system_id), null);
......
283 288
                     (Reader)(new StringReader(doc)),null);
284 289
          htmldoc.print(out);
285 290
        } catch (Exception e) {
286
          out.println("Error transforming document:\n" + e.getMessage());
291
          //out.println("Error transforming document:\n" + e.getMessage());
292
          // set content type and other response header fields first
293
          response.setContentType("text/xml");
294
          out.println(doc);
287 295
        }
288 296
      }
289 297
  }

Also available in: Unified diff