[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

MatTS, an alternate syntax for XSLT

Subject: MatTS, an alternate syntax for XSLT
From: "Sean M. Burke" <sburke@xxxxxxxx>
Date: Sat, 01 Apr 2006 03:26:14 -0900
xlove
[NB: at http://use.perl.org/~TorgoX/journal/29175 I have pasted a copy of this message, in case the Unicode characters don't show up right in your email client.]

For some time now, the syntax of XSLT has bothered me -- its verbosity, that gushing typographic clutter, clearly encumbers best-practices programming.

XLove [http://www.cs.rit.edu/~dpl1926/] suggests an alternate syntax that emphasizes the functional nature of XSLT; and SXML [http://okmij.org/ftp/Scheme/SXML.scm] posits a representation of general XML data as Lisp forms. But both of these, aside from reducing close-tags to a single character, do very little to solve XSLT's clutter problem.

I think it's time for a better alternate syntax for viewing and writing XSLT. In this document I will propose such a system, which I call MatTS (Matryoshka Transformation Syntax).

XLove and SXML start out with an implementation of alternate syntax as an input which becomes conventional XSLT. But so as to better tune the alternate syntax as a visual artifact, I instead choose to implement the alternate syntax as a view of XSLT, which XSLT becomes. (As such, I have left the development of an editing environment as a mere implementational detail which I am sure the marketplace will provide for in due time, as it has done for UML, that other recent breakthrough in informatic display.)

Most hierarchy-based notations display their structure with bits of matching punctuation, whether parens, brackets, or braces. However, I view this as a holdover from the days of daisywheel printers and other forms of mere movable type. With our modern bitmap displays and LASER printers, it is far easier and clearer to display structure as series of matryoshka-like [http://en.wikipedia.org/wiki/Matryoshka_doll] nested shapes -- say, boxes. Clearly, (foo ((bar) baz)) is inferior to the clarity of this diagram:

    +---------------+
    |foo +---------+|
    |    |+---+    ||
    |    ||bar|    ||
    |    |+---+    ||
    |    |baz      ||
    |    +---------+|
    +---------------+

[presented as ASCII art for ease of transmission]

This sort of matryoshka notation is the basis of my new variant syntax for XSLT, and it in fact gives the syntax its name. But in and of itself, this notation would go no further than Xlt and SXML at relieving XSLT's clutter problem. The greatest benefit of MatTS is in providing a terse syntax for all important XSLT constructs. In the best tradition of modern higher mathematical notation and typography
[http://math.berkeley.edu/~ilya/papers/PL_Grassmannian/gel_dikf.pdf], I have chosen well-known Greek letters and various printers' symbols for the operators.


The following table illustrates and specifies this formalism:

    N1 apply-imports
    N2 apply-templates
    O attribute
    N attribute-set
    N; call-template
    N> choose
    O comment
    N< copy
    N3 copy-of
    N decimal-format
    O element
    N8 fallback
    N6 for-each
    O if
    N) import
    N include
    N key
    N< message
    N namespace-alias
    N= number
    O otherwise
    N output
    N' param
    N preserve-space
    N5 sort
    N? strip-space
    N# stylesheet
    N template
    N9 text
    N$ transform
    N: value-of
    N4 variable
    O when
    O with-param
    N  processing-instruction

    B?... test="..."
    b... name="..."
    b	... match="..."
    B'... select="..."
    B+...B; (general attribute value)

The preceding explanation aside, the best way to appreciate MatTS is by simply trying it out -- MatTS as a visualization application is itself implemented in browser-accessible XSLT, and so can be used to view other XSLTs as well as itself:
http://interglacial.com/~sburke/pub/xsl/matts_usage_example.xsl
http://interglacial.com/~sburke/pub/xsl/matts.xsl
Compare with the clutter of those XSLs when viewed in conventional XSLT notation:
http://interglacial.com/~sburke/pub/xsl/matts_usage_example.xsl.txt
http://interglacial.com/~sburke/pub/xsl/matts.xsl.txt



-- Sean M. Burke http://search.cpan.org/~sburke/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.