Tool To Convert Xml To Html Using Xsl
Prerequisites Familiarity with XML and other W3C standards is useful. To run the examples in this article, install the eXist XML database along with its XQuery extension function for digital publishing. Storing data, for example as part of an XForms/REST/XQuery [XRX] architecture (see ), is commonplace today. You can query, retrieve, and serialize data stored in this manner to the desired format. For web applications, developers might want to allow users to retrieve data in HTML format (to be viewed in their web browser) or as a PDF file (to be downloaded for later use). This article shows how you can convert XML data to HTML, to XSL-FO from that HTML, and to PDF from the XSL-FO with the help of an XQuery extension function based on the CSSToXSLFO tool (see ). Radian To Degree Calculator Program more.
Converting XML data to other formats. Level Unlocker Hamsterball Gold 3.6 on this page. Frequently used acronyms • CSS: Cascading stylesheet • HTTP: Hypertext Transfer Protocol • JAR: Java archive • LDAP: Lightweight Directory Access Protocol • SQL: Structured Query Language • W3C: World Wide Web Consortium • XSL-FO: Extensible Stylesheet Language Formatting Objects • XSLT: Extensible Stylesheet Language Transformations Typically, you need two XSL stylesheets to transform data from XML to HTML and XSL-FO: one to transform XML to HTML and one XSL-FO stylesheet to transform the HTML to an XSL-FO document, which you then convert to PDF using an XSL-FO processor. This process means that in an environment such as a web application that generates reports in HTML and PDF, you must write a new XSLT stylesheet that transforms data to HTML, and then write, debug, and maintain the corresponding XSL-FO stylesheet. Keeping up with these stylesheets can be difficult, and XSL-FO isn't easy to work with.
Fortunately, because the reports don't have to be sophisticated, you can easily express the layout in a CSS file. Then, you can further process the CSS file using the CSSToXSLFO utility, which can generate the XSL-FO document with just a bit of coding. This process and other, similar situations are perfect use cases for the approach that this article presents—namely, writing an XSLT stylesheet that transforms XML to HTML, then adding a few extra CSS instructions to it so that it can transform the HTML to XSL-FO and then to PDF. The CSSToXSLFO utility The CSSToXSLFO utility allows conversion of an XML document, together with a CSS version 2 (CSS2) stylesheet, into an XSL-FO document.
To use this utility, I developed an XQuery extension function to the eXist XML database as part of the XQuery extension module for digital publishing. This utility processes most of the CSS2 specifications. For dealing with specific XSL-FO features, it provides several CSS extension instructions that browsers typically ignore. Use these properties in the @page rule of the @media print section in the CSS stylesheet. The properties are related to page regions, numbering, references, leaders, named strings, hyphenation, footnotes, external graphics, and foreign elements. Intervideo Windvd 8 Gold. Be sure to look at the manual for the CSSToXSLFO utility (see ) for more information on the tool and tips for refining the XSLT stylesheets that you design.