6 ms·
XSLT is purely declarative, not just kind of. Those ifs and switches are not imperative constructs, they're evaluated functionally. xsl:if conditionally appli
by T-hawk 13y ago
XSLT is purely declarative, not just kind of. Those ifs and switches are not imperative constructs, they're evaluated functionally. xsl:if conditionally applies a template, which kind of looks imperative and control-flowy, but is really functional all the way through.
<xsl:if test="x">template</xsl:test>
is basically this in Lisp:
(if eval(x) (apply-template template) nil)
And <xsl:for-each> is equivalent to map in Lisp. It's a functional projection, not an imperative loop, even if the syntax looks like that of an imperative language.