SV: [jdom-interest] transforming xsl to html question
david
simoon at theworld.com
Wed Mar 19 08:59:48 PST 2003
Yes you're right -- they are empty. However setExpandEmptyElements(true)
doesn't seem to change the output -- I still get the <img foo /> type
endings
On 19 Mar 2003, Stephan Trebels wrote:
> Both these Elements _are_ empty - they have no content.
> setExpandEmptyElements is the way to go IMO.
>
> Stephan
>
> On Wed, 2003-03-19 at 17:04, david wrote:
> > 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"></=
script>
> >
> > 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 be=
low
> > 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
> > >
> > >
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yo=
urhost.com
> --
> Stephan Trebels <stephan at ncube.de> Consultant
> company: nCUBE Deutschland GmbH, Hanauer Str. 56, 80992 Munich, Germany
> phone: cell:+49 172 8433111 office:+49 89 1498930 fax:+49 89 14989350
>
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@your=
host.com
>
More information about the jdom-interest
mailing list