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

Stephan Trebels stephan at ncube.de
Wed Mar 19 08:11:20 PST 2003


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="text/javascript" src="/scripts/date.js" />
> instead of <script type="text/javascript" src="/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 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å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
> >
> >
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.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





More information about the jdom-interest mailing list