Suppose that instead of returning the result of an ACORD search request as an ACORD XML response, we need to return a report formatted for human consumption, say as PDF. In an earlier section of these examples, Updating a Relational Database, we saw how to resolve an inquiry ACORD message and return a result in raw XML format; but how can we leverage DataDirect XQuery™ to create a well-formatted report instead?
XSL-FO (XSL Formatting Objects, http://www.w3.org/TR/xsl) is an XML vocabulary for specifying formatting semantics; in simpler words, XSL-FO specifies an XML structure that is used to describe richly formatted documents, in particular documents that can be easily converted into readily usable PDF or PostScript documents, for example. This implies that if the output of your XQuery executing an inquiry is not a ACORD XML document, but an XSL-FO document containing both formatting information and data, then that XSL-FO document can be converted into PDF. Many commercial and open source technologies are available for this purpose — for example, Apache FOP (http://xmlgraphics.apache.org/fop/. And development environments like Stylus Studio provide visual tools that make creation of XQuery that generates XSL-FO based on dynamic data very easy.
The XQuery example available for download here processes a tc-301 message "party search," and then generates an XSL-FO document that can be converted into PDF.
![]()
Now that you have seen several examples of using DataDirect XQuery™ to query and update relational data and produce PDF reports, go to Using DataDirect XQuery™ to Bind External Variables to Dynamic Values to learn how to use the DataDirect XQuery™ XQJ implementation to execute the XQuery examples described in the previous sections.