Good question, except that you're not asking it in the right forum. Xerces
doesn't "transform XML to PDF using a XSL file". Looks like you're using
FOP [1] and also perhaps Xalan is involved in the transform. I'd suggest
you ask this question on the FOP user mailing list.

Thanks.

[1] http://xmlgraphics.apache.org/fop/

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

Alvaro Moraleda <alvaro.moral...@gmail.com> wrote on 04/22/2009 10:55:31
AM:

> Hi everyone!
> I'm working with xerces to transform XML to PDF using a XSL file. I
> have the following XML:
>
>    <comment  content=" blablablabla&#xa;blablablabla" />
>
>
> (The field "content" is written by an user of my application)
>
> When I try to transform the XML to PDF the newline doesn't appears.
> Do I miss something?
>
> Thanks!
>
> This is my java code:
>
>       try {
>          // configure fopFactory as desired
>          FopFactory fopFactory = FopFactory.newInstance();
>          FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
>
>          // Setup output
>          OutputStream out = new java.io.FileOutputStream(pdfFile);
>
>          out = new java.io.BufferedOutputStream(out);
>
>          try {
>             // Construct fop with desired output format
>             Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,
> foUserAgent, out);
>
>             // Setup XSLT
>             TransformerFactory factory =
TransformerFactory.newInstance();
>             Transformer transformer = factory.newTransformer(new
> StreamSource(xsltfile));
>
>             // Set the value of a <param> in the stylesheet
>             transformer.setParameter("versionParam", "2.0");
>
>             // Setup input for XSLT transformation
>             Source src = new StreamSource(xmlPath);
>
>             // Resulting SAX events (the generated FO) must be
>             // piped through to FOP
>             Result res = new SAXResult(fop.getDefaultHandler());
>
>             // Start XSLT transformation and FOP processing
>             transformer.transform(src, res);
>
>          } finally {
>             out.close();
>          }
>
>       } catch (Exception e) {
>          e.printStackTrace(System.err);
>       }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to