[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: JDK14/JDOM: generating a DOCTYPE decl. in output?
From: dmkarr@xxxxxxxxxxxxx (David M. Karr)
Date: 15 Mar 2002 16:39:48 -0800
jdom encoding
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@xxxxxxxxxxxxx


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.