HTML is to HAML as XSLT is to ...?
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]})
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 (eg oXygen) gives a much better productivity boost than having a more concise syntax.
Thanks to pointers from Michael Kay:
RXSLT
"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>
XSLTXT
Very old (2002), abandoned long ago. Example:
tpl .name "foo" ("a", "b")
"SELECT "
val "$a"
" FROM "
val "$b"
http://savannah.nongnu.org/projects/xsltxt
LX
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/
链接地址: http://www.djcxy.com/p/68156.html上一篇: 主干和把手的国际化