XSL:FO debugging methods

Here should go questions about transforming XML with XSLT and FOP.
bobogs
Posts: 1
Joined: Tue Aug 31, 2010 5:29 pm

XSL:FO debugging methods

Post by bobogs »

When I run a FO PDF (XEP) transformation scenario that is in development, I sometimes get errors such as "Element 'fo:table-cell' cannot be a child of 'fo:table-cell'. Only block-level elements are permitted in this context." The Oxygen IDE doesn't have a tight integration to where I can doubleclick that error and it takes me to the XSL file's line (or even the template or section) that's causing the error. In the past, the only way I've been able to do this is to use a different scenario that generates the intermediate FO document, then validate that document against XEP's fo.dtd. This is cumbersome, so I'm looking for better ways to validate the resulting fo within my normal PDF transformation scenario, as well as better methods for debugging the scenario and its results.

Thanks!
Gary
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: XSL:FO debugging methods

Post by adrian »

Hello,

This sort of error integration of the FO processor in Oxygen would first mean to locate the problem in the FO and then back-map the result from the FO to the source XML and XSLT files. Any misinterpretation would lead to a misleading result so it's a bit of a hit-or-miss.
We may look into implementing this in a future version of Oxygen.

Regarding your use case. You've got the right idea, two scenarios are the way to go. First XML+XSL to FO, then FO to PDF.

If you always validate your FO files with the same DTD you can change the DTD/schema in the FO document type association(Options -> Preferences -> Document Type Association, FO, Edit). Duplicate it if asked and in the document type editing dialog, in the Schema tab(selected by default) change the schema type to DTD, and browse for your DTD in the field below. OK in all dialogs.
Next time a FO is opened/created it will be automatically validated with the newly configured DTD. This should at least help you with one of the steps.

Once you have the error location in the FO you should be able to locate its source back in the XML or XSL file with the help of the debugger. You should execute the scenario through the debugger(Document -> Transformation -> Debug Scenario) and run the debugger: Debugger -> Run
The resulting output will have back-mapping to the source XML and XSL files. If you find the location of the error in the resulting FO you should also see the location in the XSL that generated that fragment. The XML and XSL editors will automatically have the corresponding lines highlighted.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply