This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

JDK14/JDOM: generating a DOCTYPE decl. in output?


I'm using JDK1.4 and JDOM.  I have a stylesheet that is attempting to generate
a HTML 4.01 page.  It views fine in Mozilla and IE6, but I'm trying to "dot all
the i's" by validating the output in the W3C's HTML validator
(http://validator.w3.org/).

When I run the validator, I tell it to determine the character encoding and
doctype automatically.  I see the following output (somewhat expected, as
you'll see):

--------------
  Warnings

      * Warning: No Character Encoding detected! To assure correct validation,
      processing, and display, it is important that the character encoding is
      properly labeled. Further explanations.

  Below are the results of attempting to parse this document with an SGML parser.

        Fatal Error: no document type declaration; will parse without validation

  I could not parse this document, because it uses a public identifier that is
  not in my catalog.
--------------

Here is the beginning of my generated HTML output:
--------------
<html>
  <head>
    <title>March 2002 Calendar</title>
    <style type="text/css">.calendarTitle {font-family:Helvetica;text-align:center;font-size:24pt;font-weight:bold;} .dayName {font-family:Helvetica;} .dayNumber {font-family:Helvetica;} .eventText {font-size:8pt;} .longEventText {font-size:12pt;}</style>
  </head>
--------------

As you can see, neither a character encoding or doctype is included.

Here is the beginning of my stylesheet, where I'm attempting to generate the
encoding and doctype:

--------------
<?xml version="1.0"?>
<xsl:stylesheet
 version="1.0"
 exclude-result-prefixes="dt"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:dt="http://xsltsl.org/date-time";>

 <xsl:output method="xml" indent="yes" encoding="utf-8"
  doctype-public="-//W3C//DTD HTML 4.01//EN"
  doctype-system="http://www.w3.org/TR/html4/strict.dtd";
  omit-xml-declaration="no" />
--------------

So, what do I have to do in the stylesheet to get the correct character
encoding and doctype generated?  Do I have to have a manual "xsl:text" element
with 'disable-output-escaping="yes"' and enclose my DOCTYPE in a CDATA block?
That doesn't even handle the character encoding, I guess.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]