XSLT is an acronym for "ExtensibleStylesheetLanguageTransformations". It is a language designed for transforming XML documents into other formats. There's no restriction on the format of the output, and in particular the somewhat less-well-known XslFormattingObjects portion of XSL is not a requirement. XSLT is in the category FunctionalProgrammingLanguage''''''s. XSLT does not allow programmers to modify state. XSLT templates behave like pure functions. A light bulb goes on. Trying to write an XSL document with a procedural mind-set is certain to end in frustration. An interesting characteristic of XSLT is that the language syntax is defined to be well-formed, valid XML, which makes it verbose. Imagine the angle brackets as parentheses and it begins to look familiar. The basic element of an XSL sheet is a template rule. The processor walks the document tree and attempts to match each node with a template rule. When a rule is matched, it is fired, typically resulting in generation of some new text and data, possibly transformed in other ways, and some information copied from the input document. The processor uses a complex syntax in the match patterns, and will recursively process nodes. Some elements can use the XpathLanguage syntax. A simple graphic of the XSL engine, from xml.com: http://www.xml.com/1999/04/holman/xsl.gif ---- '''Beginners corner''' See ''Using XML Queries and Transformations'' from Wrox '''Sample chapter from Professional VB XML''' at http://www.developerfusion.com/scripts/print.aspx?id=89 Try doing some transformations - http://xslt.sitesfree.com/ ---- '''Known uses of XSLT''' * JaxMe's BeanWriter creates J2EE conformant entity beans for EJB from XML http://jaxme.sourceforge.net/docs/BeanWriter.html * The code for the Turing Machine stylesheet: http://www.unidex.com/turing/utm.xsl.htm * MathMl's ctop.xsl, which transforms "content elements" markup into "presentation elements" markup. * http://xcb.freedesktop.org/ uses XML to describe the XwindowProtocol, and XSLT to transform it into specific language bindings. * ApacheCocoon * AxKit * XmlForOnceAndOnlyOnce '''Some references''' * Syntax and semantics: http://www.w3.org/TR/xslt * http://www.ibiblio.org/xml/books/bible2/chapters/ch17.html * (Not) Looping in XSLT: http://www.dpawson.co.uk/xsl/sect2/N5019.html * XSLT is Turing Complete: http://www.unidex.com/turing/utm.htm * Or it's missing some core FP? http://www.kuro5hin.org/story/2002/1/15/1562/95011 * XSL weaknesses: http://www.xml.com/pub/a/1999/05/xsl/xslconsidered_1.html ----- '''Is XSLT really one of the FunctionalProgrammingLanguage''''''s?''' No, apparently it is not. Lack of side effects and support for minimal function declarations do not a functional language make. How about function as values, easy and convenient functional composition (=support for lambda expressions), currying to name but a few features of functional languages. A functional language is about manipulating functions, not tree structures. I'm sure that many functional programming afficionados will find the comparison with such a clumsy language appalling. ''I tend to think of it as a "rule-based" language - similar in concept to rule based expert systems. -- JeffGrigg'' Or, maybe it is: : "Dimitre Novatchev, author and XSL developer, has written an article demonstrating how functions (templates in XSL) can indeed be passed as a data type using XML namespaces in clever manner. Whether this qualifies templates as first class data types is certainly debatable, but Novatchev's technique makes it clear that XSL can operate as a weakly-typed functional language." : -- http://www-106.ibm.com/developerworks/xml/library/x-xslrecur/ '''Some most general functional programming design patterns are supported by the FXSL functional programming library for XSLT:''' http://fxsl.sourceforge.net/ The following articles describe the support for these design patterns and their use in specific problem areas: * "Dynamic Functions using FXSL: Composition, Partial Applications and Lambda Expressions" ** http://fxsl.sourceforge.net/articles/PartialApps/Partial%20Applications.html * "Casting the Dice with FXSL: Random Number Generation Functions in XSLT" ** http://fxsl.sourceforge.net/articles/Random/Casting%20the%20Dice%20with%20FXSL-htm.htm * "An XSL Calculator: The Math Modules of FXSL" ** http://fxsl.sourceforge.net/articles/xslCalculator/The%20FXSL%20Calculator.html "What kind of language is XSLT?" "XSLT is based on the concepts of functional programming in the tradition of languages such as Lisp, Haskell, and Scheme. A style sheet is made up of templates that are essentially pure functions -- each template defines a fragment of the output tree as a function of a fragment of the input tree, and produces no side effects." http://www-106.ibm.com/developerworks/xml/library/x-xslt/. "The Functional Programming Language XSLT - A proof through examples" http://www.topxml.com/xsl/articles/fp/ -- StevenNewton Is XSLT a logic language?