Translating XQuery into XSLT
The WWW Consortium (W3C) has recently presented a working draft of XQuery, which is intended to serve as standardized query language for XML. XQuery and other high-level query languages for XML documents are not yet implemented by commercial products. Yet many browsers have already built-in XSLT support for transforming XML documents. XSLT is a standard way of performing structural rearrangement or presentational transformation of XML documents, but formulating complex queries is, compared to XQuery, difficult and errorprone. If XQuery expressions could be translated into XSLT (e.g. by a translator written in Java or XSLT itself), the benefits of XQuery would be immediately available to a wide range of commercial products. This paper introduces a process for translating queries formulated in XQuery syntax into XSL stylesheets. The process is described independently from a particular implementation by means of an ASM (Abstract State Machine). The ASM traverses the parse tree of a particular query and translates each node into corresponding XSLT commands. The result of this translation process is an XSL stylesheet that can be applied to an XML document in order to perform the given query. The presented ASM can be easily coded in Java or XSLT to implement a prototype XQ2XSL translator.
KeywordsQuery Language Transition Rule Parse Tree Node Identity Query Execution
Unable to display preview. Download preview PDF.
- 1.J. D. Ullman A. V. Aho, R. Sethi. Compilers:Principles, Techniques and Tools. World Student Series. Addison Wesley, 1986.Google Scholar
- 2.M. Anlauff. XASM-An Extensible, Component-Based ASM Language. In Proc. ASM 2000. Springer LNCS 1912, 2000.Google Scholar
- 3.XSL Working Group at the W3C. The Query Language Position Paper of the XSL Working Group (Draft 11/18/98). http://www.w3.org/, 1998
- 4.E. Börger and D. Rosenzweig. A mathematical definition of full Prolog. In Science of Computer Programming. 1994.Google Scholar
- 5.E. Börger and W. Schulte. A Programmer Friendly Modular Definition of the Semantics of Java. In Formal Syntax and Semantics of Java. Springer LNCS 1523, 1998.Google Scholar
- 6.T. Bray, J. Paoli, C. M. Sperberg-McQueen, and E. Maler. Extensible Markup Language (XML) 1.0 (Second Edition). http://www.w3.org/, October 2000.
- 7.P. Buneman, S. Davidson, G. Hillebrand, and D. Suciu. A Query Language and Optimization Techniques for Unstructured Data. In Proc. ACM-SIGMOD, 1996.Google Scholar
- 8.D. Chamberlin, J. Robie, and D. Florescu. Quilt: An XML Query Language for Heterogeneous Data Sources. In Proc. WebDB, 2000.Google Scholar
- 9.J. Clark. XSL Transformations (XSLT) Version 1.1. http://www.w3.org/TR/xslt11, December 2000. Working Draft.
- 10.S. Cluet, S. Jacqmin, and J. Sim’eon. The New YaTL: Design and Specifications. Technical report, INRIA, 1999.Google Scholar
- 11.A. Deutsch, M. Fernandez, D. Florescu, A. Levy, and D. Suciu. A Query Language for XML. In Proc. WWW8, 1999.Google Scholar
- 12.P. Fankhauser, M. Fernandez, A. Malhotra, M. Rys, J. Simeon, and P. Wadler. XQuery 1.0 Formal Semantics, Working Draft. http://www.w3.org/, June 2001.
- 13.M. Fernández and J. Marsh. XQuery 1.0 and XPath 2.0 Data Model: Working Draft. http://www.w3.org/, June 2001.
- 15.Y. Gurevich. Logic and the challenge of computer science. In Trends in Theoretical Computer Science. Computer Science Press, 1988.Google Scholar
- 16.H. Hosoya and B. Pierce. XDuce: A Types XML Processing Language (Preliminary Report). In Proc. WebDB, Springer LNCS 1997, 2000.Google Scholar
- 17.S. E. Hudson. CUP LALR Parser Generator For Java: User’s Manual. http://www.cs.princeton.edu/appel/modern/java/CUP/manual.html, 1999.
- 18.S. C. Johnson. YACC — Yet Another Compiler Compiler. Technical Report C.S. Rechnical Report #32, AT & T Bell Labs, 1975.Google Scholar
- 19.J. Robie. XQL ‘99 Proposal. http://www.ibiblio.org/xql/xql-proposal.html, 1999.
- 20.M. Schrefl and G. Kappel. Cooperation Contracts. In T. J. Teorey, editor, Proc. 10th Int. Conf. on Entity-Relationship Approach (ER ‘91), 1991.Google Scholar
- 21.C. Wallace. The Semantics of the C++ Programming Language. In Specification and Validation Methods. Oxford University Press, 1995.Google Scholar