[jdom-interest] XSL transformations and missing doctypes

Lee Turner lee at leeturner.org
Wed Aug 25 00:49:32 PDT 2004


Hi

Yes I am specifying the doctype in the xsl:output, but I didn't think that
xsl:output was only applicable when the output document was to be xml.  Once
the result tree has been generated by the xslt processor, xsl:output
controls the serialisation of this to an output document.  If what you say
is true then I can never generate a valid html 4.01 output document
specifying the relevant doctypes without some processing after the transform
has been done.  Is this correct ?  I have read out rules applicable for both
xml and html output controlled by the xsl:output element.

Either way, I am still outputting xml as the output format as I want well
formed xml (xhtml) so I should still be able to see the doctype information
in the output.  Like I said in my first email, this does work when I remove
JDOM from the equation which is why I sent a mail to this list (I hope
people didn't think that it was way off topic) instead of an xsl list.  If
there is nothing I can do about it then I guess I will have to do what you
say and implement some processing after the transformation to insert the
correct doctypes but this seems like a hack when afaik I should be able to
do it using pure xsl.

I really appreciate you taking the time to respond to my email.
Many thanks
Lee

----- Original Message ----- 
From: "Per Norrman" <per.norrman at austers.se>
To: "Lee Turner" <lee at leeturner.org>
Cc: <jdom-interest at jdom.org>
Sent: Wednesday, August 25, 2004 8:19 AM
Subject: Re: [jdom-interest] XSL transformations and missing doctypes


> Hi,
>
> Are you specifying the doctype using the xsl:ouput element? In that
> case, note that the xsl:output element is only applicable when
> the XSLT processor is generating XML from the result tree.
>
> Since you are transforming into xhtml, you can easily set
> the doctype after the transformation is completed.
>
> /pmn
>
> Lee Turner wrote:
>
> > Hi
> >
> > I am using JDOM b10 in my system where I am using xsl to transform my
JDOM
> > documents into xhtml to be displayed on the front end.  My problem is
that
> > when the transformation has been done I am missing the doctype that I
set in
> > the xsl.  The code I am using is as follows :
> >
> >         //snip
> >         Transformer transformer = template.newTransformer();
> >         JDOMSource source = new JDOMSource(incomingDocument);
> >         JDOMResult result = new JDOMResult();
> >         transformer.transform(source, result);
> >         return result.getDocument();
> >
> > I have taken my xsl and tried that outside of JDOM, using static xml
instead
> > and the doctype is there in the output and I have even just used the
> > javax.xml classes to do the transform DOMSource and StreamResult etc
> > and the doctype is in the output here as well.
> >
> > I have looked on the web and news groups and there seem to be a few
> > references to missing doctypes, but I couldn't find anything to say
whether
> > it has been fixed in the latest CVS of JDOM.  I downloaded the daily
> > snapshot from the JDOM web site and still saw the same behaviour.
> >
> > Has anyone else seen this when performing transformations using JDOM  ?
> > Any help would be greatly appreciated.
> >
> > Kind regards
> > Lee
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> >
>
>



More information about the jdom-interest mailing list