# HG changeset patch # User Maxim Dounin # Date 1393521573 -14400 # Node ID cb41e7c634c56ddcf7879c655e9bf70a4f548dd7 # Parent e93b6e98b8179ee916db37ba1d408c9dce1b23ef XSLScript: README and LICENSE. diff --git a/LICENSE b/LICENSE new file mode 100644 --- /dev/null +++ b/LICENSE @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2014 Maxim Dounin + * Copyright (C) 2014 Nginx, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/xslscript.txt b/README rename from xslscript.txt rename to README --- a/xslscript.txt +++ b/README @@ -1,32 +1,37 @@ -JAR can be found here: -http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/www/hiawatha/README.html +This code is a replacement for XSLScript, previously available from +http://pault.com/pault/XSLScript/. It is not recommended for general +use, but rather a replacement for what is used by nginx. -Recovered from: +Snapshot of the original XSLScript documentation is given below, +as recovered from: http://moemesto.ru/link/6865082 http://moemesto.ru/philonov/page/6865082/download/INODE.RU%20/%20ProgrammaZm%20/%20XSLScript%20-%20%D0%B7%D0%B0%D0%BC%D0%B5%D0%BD%D0%B0%20XSLT -XSLScript - замена XSLT -[ 2004/07/16 ProgrammaZm ] +############################################################################### -Возможно удобная замена XSLT. Файлы XSLScript преобразуются в xslt. - - - // Источник: http://pault.com/pault/XSLScript/ - Since Year 2000 Version 0.7 Check out TerseXML project XSLScript is for those, who are writing complex XSLT stylesheets. -XSLScript is a terse notation for writing complex XSLT stylesheets. XSLScript is part of Hiawatha web-server, but XSLScript also can be used stand-alone. +XSLScript is a terse notation for writing complex XSLT stylesheets. +XSLScript is part of Hiawatha web-server, but XSLScript also can be +used stand-alone. To execute XSLScript script: xsls some.xml some.xsls -The XSLScript script (some.xsls) gets compiled into corresponding XSLT stylesheet and then generated XSLT stylesheet is applied to the file some.xml (no temporary .xsl file is created, this all happens in the memory). The actual XSLT tranformation is performed by SAXON. There is 1-1 lines mapping between XSLScript script and generated XSLT ( this means if some XSLScript construction starts on line 5, the corresponding XSLT construction will also start on the same line 5. ) + +The XSLScript script (some.xsls) gets compiled into corresponding XSLT +stylesheet and then generated XSLT stylesheet is applied to the file +some.xml (no temporary .xsl file is created, this all happens in the +memory). The actual XSLT tranformation is performed by SAXON. There is +1-1 lines mapping between XSLScript script and generated XSLT ( this +means if some XSLScript construction starts on line 5, the corresponding +XSLT construction will also start on the same line 5. ) To generate the XSLT stylesheet out of XSLScript script: @@ -40,21 +45,28 @@ Why XSLScript ? XSLT syntax is not for human beings. -One can write complex XSLT code in XSLScript and then generate the 100% XSLT stylesheet. Like I do. Occasionaly. +One can write complex XSLT code in XSLScript and then generate the 100% +XSLT stylesheet. Like I do. Occasionaly. Can I use my XSLT stylesheets with XSLScript? -You can use xsl:import / xsl:include to include .xsl into .xsls and to include .xsls into .xsl. +You can use xsl:import / xsl:include to include .xsl into .xsls and to +include .xsls into .xsl. What if I like writing ( optional ). +There are top-level XSLScript constructions and instructions. (exactly +like it is in XSLT). Instructions could be separated from the content +with <% and %> ( optional ). + Instruction has body and header. Body is separated from header with { } -'match', 'select', 'test' and 'name' are not written (but also could be written in some exotic cases.) -Symbols ', ", {, are special. Use \{ e t.c. if you need those special symbols in tne content of your stylesheet. +'match', 'select', 'test' and 'name' are not written (but also could be +written in some exotic cases.) + +Symbols ', ", {, are special. Use \{ e t.c. if you need those special +symbols in tne content of your stylesheet. + xsl:apply-templates, !! and xsl:number should end with ";" -Syntax of apply-templates is extremely close to the syntax of call-template. + +Syntax of apply-templates is extremely close to the syntax of +call-template. + There are few shortcuts: You can use !{xpath-expression} for X:value-of select="xpath-expression"; !! for X:apply-templates !foo() for X:call-template name="foo" X:var for X:variable -There is 'comma' shortcut. It exists for X:stylesheet (see date.xsls for example of XSLT-engine independent java binding). And also it exists for X:for-each and X:apply-templates. + +There is 'comma' shortcut. It exists for X:stylesheet (see date.xsls for +example of XSLT-engine independent java binding). And also it exists for +X:for-each and X:apply-templates. + X:for-each "//*" , X:sort { -You can not write X:sort as an element, but you should use 'comma' shortcut. + +You can not write X:sort as an element, but you should use 'comma' +shortcut. + The shortcut for template allows : X:template foo( bar="init", baz={markup} ) = "match" mode="some" { Download -Because SAXON (http://users.iclway.co.uk/mhkay/saxon/) is 100% free, XSLScript distribution contains everything you need to run XSLScript. +Because SAXON (http://users.iclway.co.uk/mhkay/saxon/) is 100% free, +XSLScript distribution contains everything you need to run XSLScript. -xsls.jar includes not only .class files, but also the source code of XSLScript +xsls.jar includes not only .class files, but also the source code of +XSLScript XSLScript is 100% free. @@ -157,7 +194,8 @@ Changes in version 0.7 (major rewrite) <% %> are optional. -Some verbose forms are dropped ( no X:with-param and call-template ever, e t.c. ) +Some verbose forms are dropped ( no X:with-param and call-template ever, +e t.c. ) Parser is less forgiving and some things become not intuitive. \{ \' " required. Nice dumping of generated stylesheet. @@ -169,8 +207,8 @@ Changes in version 0.51 ':' was not allowed in #NAME token. ( Allows xmlns:some= ) Multiple