I just discovered HAML, and love its succinctness and readability. Is there any kind of equivalent for XSLT? In particular, I would love something that makes it easier to distinguish between the angle-bracket-containing output and the angle-bracket-containing markup itself.
If there is not a specialised XSLT abstraction language, is there at least a generic form for XML which would also work?
EDIT For fun, I just did a quick test of using actual Haml (actually HamlPy) to generate XSLT. Shortcomings I observed:
%xsl:foo
is not succinct enough. A special character for the XLS namespace, like #foo
would be better.<meta>
are a problem)%xsl:attribute(name="foo" value="blah")
is still way too verbose. something like .foo="blah"
would be better.select
are very common, and could be made implicit: #value-of "./a[@href]" -
and =
for processing logic aren't needed, so could be repurposed for something like xquery or xpath. Or maybe {foo}
could be a shorthand for <xsl:value-of select="foo"/>
. That'd be cool: %p(style={../[@style]})
XSLT is used to transform XML documents into XHTML documents, or into other XML documents.
XSL can be used server-side and client-side. The XSL Submission has two classes of output: DSSSL-style flow objects and HTML tags.
XSLT is most often used to convert data between different XML schemas or to convert XML data into web pages or PDF documents.
XSLT Processor takes the XSLT stylesheet and applies the transformation rules on the target XML document and then it generates a formatted document in the form of XML, HTML, or text format. This formatted document is then utilized by XSLT formatter to generate the actual output which is to be displayed to the end-user.
There have been many attempts to define "user-friendly" or "compact" non-XML concrete syntax for XSLT. As far as I know, none of them have ever been used in anger by anyone other than the inventor. In the end, having a good editor that understands XSLT (e.g. oXygen) gives a much better productivity boost than having a more concise syntax.
Thanks to pointers from Michael Kay:
"Real XSLT": http://www.wilmott.ca/rxslt/rxslt.html
template doc
apply-templates
template doc/title
<H1>{apply-templates}</H1>
template doc/para
<P>{apply-templates}</P>
Very old (2002), abandoned long ago. Example:
tpl .name "foo" ("a", "b")
"SELECT "
val "$a"
" FROM "
val "$b"
http://savannah.nongnu.org/projects/xsltxt
A lisp-ish compact XML notation. Not sure if there is any special treatment for XSLT:
;; The XSLT identity transformation
(lx:namespace ((#f "http://www.w3.org/1999/XSL/Transform"))
(stylesheet version: 1.0
(template match: "node()|@*"
(copy
(apply-templates select: "@*|node()")))))
http://nxg.me.uk/dist/lx/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With