SV: [jdom-interest] transforming xsl to html question

Per Norrman pernorrman at telia.com
Wed Mar 19 05:07:42 PST 2003


Hi,

There's an setExpandEmptyElements method in XMLOutputter.

/pmn

> -----Ursprungligt meddelande-----
> Från: jdom-interest-admin at jdom.org 
> [mailto:jdom-interest-admin at jdom.org] För david
> Skickat: den 19 mars 2003 13:56
> Till: jdom-interest at jdom.org
> Ämne: [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="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= transform (xmlPage,xslStylesheet);
>              } catch (Exception e) {
>                   }
> 
> 
>              XMLOutputter outputter = new XMLOutputter(" 
> ",true,"iso-8859-1");
>              outputter.output(htmlPage,out);
> 
> 
> protected static Document transform(Document in, String stylesheet)
>          throws JDOMException {
>          try {
>              Transformer transformer = 
> TransformerFactory.newInstance()
>                  .newTransformer(new StreamSource(stylesheet));
>              JDOMResult out = 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