SV: [jdom-interest] transforming xsl to html question
david
simoon at theworld.com
Wed Mar 19 08:04:03 PST 2003
That doesn't help in the case where the tag element is not empty
eg: <script type=3D"text/javascript" src=3D"/scripts/date.js" />
instead of <script type=3D"text/javascript" src=3D"/scripts/date.js"></scri=
pt>
The xalan command line processor has a -html or -xml option to vary
between these variants. But I'm using the jdom model as in the code below
and wanted the same ability.
On Wed, 19 Mar 2003, Per Norrman wrote:
> Hi,
>
> There's an setExpandEmptyElements method in XMLOutputter.
>
> /pmn
>
> > -----Ursprungligt meddelande-----
> > Fr=E5n: jdom-interest-admin at jdom.org
> > [mailto:jdom-interest-admin at jdom.org] F=F6r david
> > Skickat: den 19 mars 2003 13:56
> > Till: jdom-interest at jdom.org
> > =C4mne: [jdom-interest] transforming xsl to html question
> >
> >
> > Hi
> >
> > I'm using JDOM to build an xml doc and then I'm transformming
> > that to HTML
> > using an xslt stylesheet. The problem I have is that the
> > html contains xml
> > style closing tags
> > ie: <img src=3D"image"/> instead of <img> </img>
> >
> > This is causing a problem with some browsers. How can I make
> > it output
> > html style closing tags.
> >
> > Xalan has an option for this on the command line that works.
> >
> > Code follows
> >
> > Thanks
> > David
> >
> >
> > try {
> > htmlPage=3D transform (xmlPage,xslStylesheet);
> > } catch (Exception e) {
> > }
> >
> >
> > XMLOutputter outputter =3D new XMLOutputter("
> > ",true,"iso-8859-1");
> > outputter.output(htmlPage,out);
> >
> >
> > protected static Document transform(Document in, String stylesheet)
> > throws JDOMException {
> > try {
> > Transformer transformer =3D
> > TransformerFactory.newInstance()
> > .newTransformer(new StreamSource(stylesheet));
> > JDOMResult out =3D new JDOMResult();
> > transformer.transform(new JDOMSource(in), out);
> > return out.getDocument();
> > }
> > catch (TransformerException e) {
> > throw new JDOMException("XSLT Trandformation failed", e);
> > }
> > }
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/yo
> uraddr at yourhost.com
>
>
More information about the jdom-interest
mailing list