!! def indent(level): return "value 'substring($space, 1, $_indent+" + str(level) + "*$autoindent)';" !! in xsl { decl param(name, select); decl const(name, select) alias variable, variable is const; decl output(method), key(name, match, use); decl stylesheet(*output="xml", version="1.0", xmlns:xsl="http://www.w3.org/1999/XSL/Transform") { output *output; const "space", !"'" + " " * 200 + "'"!; param "autoindent", 4; content; }; decl estylesheet is stylesheet ( xmlns:exsl='http://exslt.org/common', xmlns:math='http://exslt.org/math', xmlns:func='http://exslt.org/functions', xmlns:str='http://exslt.org/strings', xmlns:dyn='http://exslt.org/dynamic', xmlns:set='http://exslt.org/sets', extension-element-prefixes='exsl func str dyn set math' ); decl textstylesheet is estylesheet(*output="text") { output *output; const "space", !"'" + " " * 200 + "'"!; param "autoindent", 4; template "text()"; content; }, tstylesheet is textstylesheet; decl template(match) { param "_indent", 0; content; }; decl function(name) alias template { param "_indent", 0; content; }, call(name) alias call-template; decl text, raw(disable-output-escaping='yes') alias text; decl value(select) alias value-of, copy(select) alias copy-of; decl with(name, select) alias with-param; decl withIndent is with(%level, name="_indent", select='$_indent + %level * $autoindent'); decl apply(select, *indent=1) alias apply-templates { withIndent *indent; content; }; decl choose, when(test), otherwise; decl if(test); decl for(select) alias for-each, foreach is for; decl element(name, namespace); decl attrib(name, namespace) alias attribute; decl processing(name) alias processing-instruction; decl comment; decl import(href); decl message, error is message(terminate='yes'), warning is message(terminate='no'); } in exsl decl document(href, method) alias document; in func decl def(name) alias function, result(select); define operator "«(.*?)»" as value "%1";