Generating XSL-FO and XHTML from XSLT is not necessarily any choice.
XSL-FO is commonly used to create PDFs. To do this, you need the XSL-FO engine , for example FOP , RenderX , Antenna House , IBex , etc. However, you can convert XSL-FO to XHTML and then render in a browser.
Generally, it would be useless if your XSLT created XSL-FO and then converted to XHTML (just create XHTML directly) if you do not want to create both output formats (PDF and XHTML) with reduced effort.
** XSL-FO and XHTML can be created at the same time without supporting two complete sets of styles to produce similar output in different dictionaries **.
Instead of choosing between one or the other format or having two clearly distinguishable (but similar) style libraries, you can create your main style library to create either XSL-FO or XHTML , and then use the second transform to convert from XSL-FO in XHTML and vice versa. There are existing XSLT style sheets that you can use to do this.
In the past, I designed XSL-FO stylesheets , and then used the Render-X Stylesheet FO2HTML to convert XSL-FO output to XHTML . It converts the <block> elements to <div> , <inline> to <span> , etc.
I have not used them before, but you can also use HTML2FO style sheets to convert out XHTML to XSL-FO .
Out of the box, you can get surprisingly similar output in both formats, while maintaining one XSLT library for one specific output format.
If you don't need to customize the output a bit (for example, different header content for XHTML ), you just need to import / expand the conversion stylesheets and override the appropriate template for diverging content. This simplifies maintenance, so you donβt have to worry about updating multiple sets of stylesheets with essentially the same information.