SXSLT: Manipulation Language for XML
The growing use of XML languages has spurred the demand for means to transform XML documents. Many XML transformation systems are, however, limited in their expressive power, and fail to provide a useful collection of combinators for several tasks. This paper describes SXSLT, a practical, higher-order, concise, expressive and readable declarative XML transformation language. The language is a head-first rewriting system over abstract XML syntax trees, implemented as a library extension of Scheme. SXSLT features local scoping of re-writing “templates”, first-class stylesheets, flexible traversal strategies, the ability to re-traverse the original or the transformed trees. The language can emulate XSLT in whole or in part, in a more coherent and expressive manner. By virtue of being a Scheme library, SXSLT is seamlessly integrated with Scheme.
We illustrate the power of SXSLT with several examples abstracted from practical projects. We and other people have used SXSLT for over two years for real-life projects, ranging from authoring of static and dynamic Web pages to content-distribution engines. Our experience and user comments show that SXSLT is expressive and easy to use. We argue that this outcome is a consequence of SXSLT providing right abstractions for XML transformations, of being higher-order, declarative and extensible.
Keywords:XML SXML XSLT tree traversal Scheme
Unable to display preview. Download preview PDF.
- 1.Abresch, B.: for those keeping score... A message on the PLT-Scheme mailing list. May 30, 2002 http://www.cs.utah.edu/plt/mailarch/plt-scheme-2002/msg00998.html
- 2.Bosworth, A.: Programming Paradox. XML Magazine, February 2002 http://www.fawcette.com/xmlmag/2002 02/magazine/departments/endtag/
- 3.Durand, D.: private communication. May 22, 2002Google Scholar
- 4.ISO/IEC. Information technology, Processing Languages, Document Style Semantics and Specification Languages (dsssl). Technical Report 10179:1996(E), ISO (1996)Google Scholar
- 5.Fuchs, M.: SOXT: Building the XSL Family of Languages. The Eleventh International World Wide Web Conference. Proc. Alternate Paper Tracks (2002) http://www2002.org/CDROM/alternate/417/index.html
- 6.Hosoya, H., Pierce, B.C.: Regular expression pattern matching for XML. In The 25th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (2001) 67–80Google Scholar
- 7.Kiselyov, O.: Aviation total weather and SIGMET advisory queries. June 12, 2000 http://zowie.metnet.navy.mil/cgi-bin/oleg/get-advisories http://zowie.metnet.navy.mil/~dhuff/pqa/FNMOC.html
- 8.Kiselyov, O.: SXML as a normalized database. April 17, 2001 http://pobox.com/~oleg/ftp/Scheme/xml.html#SXML-as-database
- 9.Kiselyov, O.: A better XML parser through functional programming. In: Lecture Notes in Computer Science, Vol. 2257. Springer-Verlag, Berlin Heidelberg New York (2002) 209–224Google Scholar
- 10.Kiselyov, O.: SXML Specification. Revision 2.5. August 9, 2002 http://pobox.com/~oleg/ftp/Scheme/SXML.html
- 11.Kiselyov, O., Krishnamurthi, S.: SXSLT: Manipulation Language for XML. Master SXML file. http://pobox.com/~oleg/ftp/Scheme/SXSLT.scm
- 12.Krishnamurthi, S., Felleisen, M., Duba, B.F.: From Macros to Reusable Generative Programming. In: Lecture Notes in Computer Science, Vol. 1799. Springer-Verlag, Berlin Heidelberg New York (1999) 105–120Google Scholar
- 13.Krishnamurthi, S., Gray, K.E., Graunke, P.T.: Transformation-by-Example for XML. Practical Aspects of Declarative Languages (2000)Google Scholar
- 14.Lieberherr, K.L., Patt-Shamir, B.: Traversals of Object Structures: Specification and Efficient Implementation. Technical Report NU-CCS-97-15, College of Computer Science, Northeastern University, Boston, MA (1997)Google Scholar
- 15.Moertel, T.: XSLT, Perl, Haskell, & a word on language design. Posted on kuro5hin.org on January 15, 2002 http://www.kuro5hin.org/story/2002/1/15/1562/95011
- 17.Wallace, M., Runciman, C.: Haskell and XML: generic combinators or type-based translation? Proc. the fourth ACM SIGPLAN international conference on Functional programming (1999) 148–159Google Scholar
- 18.Wallace, M., Runciman, C.: HaXml-1.07b (2002) http://www.cs.york.ac.uk/fp/HaXml/