Jeremias Maerki-2 wrote:
>
> Ok, in this case I'd modify the application so you can write out the
> generated FO within your application. Maybe there's something special
> about that environment.
>
I modified the application to do this and then I ran the fo file that was
created through one of the FOP examples provided on your webpage
(ExampleFO2PDF.java) and it successfully converted it from FO to PDF.
Jeremias Maerki-2 wrote:
>
> I'm sure you did it right, but are you certain that you properly
> override the default XSLT implementation with Xalan 2.7.0 using the
> endorsed standards override mechanism?
>
No I'm not sure I didn't write the code originally I'm very new to using
FOP. Here is the code that does the transformation it looks like some of it
came from your examples page:
protected byte[] transform() {
byte[] result = null;
_errorCondition = false;
try {
// Setup output
ByteArrayOutputStream out = new ByteArrayOutputStream();
BufferedOutputStream bout = new
BufferedOutputStream(out);
try {
// Construct fop with desired output format
Fop fop =
this.fopFactory().newFop(MimeConstants.MIME_PDF, bout);
// Setup XSLT
Transformer transformer =
this.xsltTransformer();
// Set the value of a <param> in the stylesheet
transformer.setParameter("versionParam", "2.0");
transformer.setErrorListener(this);
if (logger.isDebugEnabled()) {
StringBuffer aLog = new StringBuffer();
aLog.append("transformer
properties:\n");
Properties properties =
transformer.getOutputProperties();
for (Iterator iterator =
properties.keySet().iterator();
iterator.hasNext();) {
String key = (String)
iterator.next();
aLog.append("\t property:" +
key + " value:" + properties.get(key));
}
logger.debug(aLog.toString());
}
// Setup input for XSLT transformation
Source src = this.xsltInput();
// 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);
// Result processing
FormattingResults foResults = fop.getResults();
if (logger.isDebugEnabled()) {
logger.debug("foResults " + foResults);
}
bout.flush();
result = out.toByteArray();
} finally {
out.close();
}
} catch (Exception exception) {
if (logger.isEnabledFor(org.apache.log4j.Level.ERROR)) {
logger.error("Exception ", exception);
}
result = new byte[] {};
}
if (_errorCondition)
result = new byte[] {};
return result;
}
The Exception Occurs on this line:
// Start XSLT transformation and FOP processing
transformer.transform(src, res);
Jeremias Maerki-2 wrote:
>
> I don't think the difference in processor technology should make any
> difference here. Normally, the choice of JVM and application server is a
> more likely cause.
>
> On 10.01.2007 18:48:12 pwillsey wrote:
>>
>> I ran the transformation from both computers on the command line, the FO
>> file
>> was identical and did not contain a fo:simple-page-master element with
>> more
>> then one fo:region-body. I'm using Xalan 2.7.0 on both machines for XSLT
>> processing. Not sure if this is relevant but the machine I'm having
>> problems with is running OS X with an intel chip and the development
>> machine
>> is a powerpc.
>>
>>
>> Jeremias Maerki-2 wrote:
>> >
>> > If you haven't done so already, run only the XSLT transformation
>> outside
>> > your application (on the command-line) and inspect the generated FO
>> file.
>> > You may also need to verify that you're using the same XSLT processor
>> in
>> > both environments.
>> >
>> > On 10.01.2007 06:33:05 pwillsey wrote:
>> >>
>> >> Hello,
>> >> I'm getting a validation exception:
>> >> javax.xml.transform.TransformerException:
>> >> org.apache.fop.fo.ValidationException: Error(Unknown location): For
>> >> fo:simple-page-master, only one fo:region-body may be declared.
>> >>
>> >> But I've checked the XLST sheet and there is no fo:simple-page-master
>> >> element with more then one fo:region-body. I've also tested this on
>> >> another
>> >> machine and it works fine. I'm using FOP V. 0.93 (on Both machines).
>> >>
>> >> Not sure if this makes a difference but I'm using FOP in a webobjects
>> >> project and I get the exception when I deploy the project but not when
>> I
>> >> run
>> >> it using eclipse on my development machine.
>> >>
>> >> Any help would be greatly Appreciated
>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/FOP-Problem-tf2950761.html#a8269664
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]