Re: [xsl] XML + XSLT = SVG using FOP example needed...

Subject: Re: [xsl] XML + XSLT = SVG using FOP example needed...
From: "tpass001" <tpass001@xxxxxxxxxxx>
Date: Mon, 26 Aug 2002 16:34:20 -0500
Hey Robert,

This small piece of code will make it clear.

=================================================================
try {
  String xsl = new String(getServletContext().getRealPath("/") +
"webSVG.xsl");
  ByteArrayOutputStream out = new ByteArrayOutputStream();
    res.setContentType("image/svg+xml");
  Driver driver =new Driver();
   driver.setOutputStream(out);
    driver.setRenderer(Driver.RENDER_SVG);
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source xslSource = new StreamSource(new URL("file:" +
xsl).openStream());
    javax.xml.transform.Transformer transformer =
tFactory.newTransformer(xslSource);
    Source xmlSource = new StreamSource(new StringReader(xml));
    transformer.transform(xmlSource, new
SAXResult(driver.getContentHandler()));
  byte[] content = out.toByteArray();
    res.setContentLength(content.length);
     res.getOutputStream().write(content);
  res.getOutputStream().flush();
  cat.debug("transformToSVG, leaving");
 } catch (Exception ex) {
   throw new ServletException(ex);
    }
=================================================================

So what I am trying to do is to have a multiple document output format for
our application using FOP. We already output html using xslt and now using
FOP we output in PDF, PCL, PS etc. all except SVG, which is what I am
working on. I know that FOP can take SVG and embed it into the PDF like
other image types. I do not want to do that. I want to be able to generate
SVG by setting the  driver.setRenderer(Driver.RENDER_SVG); to give me the
output.

So now my question is that I have spent the entire day to find a simple xslt
example that will take the xml source as an InputSource and the xslt to
produce the svg. I am new to svg and do not know much about it yet. So, for
right now even the most simplest of svgs will do :)

TP.


----- Original Message -----
From: "Robert Koberg" <rob@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, August 26, 2002 4:12 PM
Subject: RE: [xsl] XML + XSLT = SVG using FOP example needed...


> Hi,
>
> I think you need to work on the concept a little :)
>
> First, you might want to come up with the SVG first.  Then you can see
what data
> you need to get it to that structure.
>
> From your description, I think you have things a little mixed up. You
don't use
> FOP to transform the XSL and XML. You can reference SVG in the FOP,
though. Even
> then, only very simple SVGs can be used.
>
> Do some searches to get more info to refine your ideas.
>
> best,
> -Rob
>
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of tpass001
> > Sent: Monday, August 26, 2002 1:45 PM
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] XML + XSLT = SVG using FOP example needed...
> >
> >
> > Hey ,
> >
> > i need help to find out where I can find one complete example to
transform
> > xml using xslt to svg using FOP. I have all the other output formats
working
> > so I know what I am doing is right. i have the xml ready and it is as
simple
> > as it can get, so i need a simple example xslt to convert it to svg for
a
> > proof of concept.
> >
> > my xml is something like
> > <header>
> >     <body>
> >         <cell>cell data 1</cell>
> >         <cell>cell data 2</cell>
> >         <cell>cell data 3</cell>
> >     </body>
> > </header>
> >
> > The output I expect could be as simple as 3 lines which say
> > cell data 1
> > cell data 2
> > cell data 3
> >
> > I would appreciate it, if someone could point me in the right direction.
> >
> > Thanks in advance.
> >
> > TP.
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread