changeset 10:cb41e7c634c5

XSLScript: README and LICENSE.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 27 Feb 2014 21:19:33 +0400
parents e93b6e98b817
children 01dc9ba12e1b
files LICENSE README xslscript.pl xslscript.txt
diffstat 3 files changed, 94 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
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.
+ */
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 <xsl:something? 
 
-You can write XSLT instructions in plain XSLT, XSLScript preprocessor will not touch them and will pass those constructions as-is.
+You can write XSLT instructions in plain XSLT, XSLScript preprocessor
+will not touch them and will pass those constructions as-is.
 
 Top-level elements should be plain XSLScript.
 
 What is XSLScript ? 
 
-XSLScript is just syntax sugar, 1-1 mapping of XSLT. The only exception is that XSLScript has 'else' (which is missing in XSLT). In XSLScript if-else is translated into appropriate xsl:choose-when-otherwise. XSLScript could get more 'non-xslt' semantics if you ask me for something you need.
+XSLScript is just syntax sugar, 1-1 mapping of XSLT. The only exception
+is that XSLScript has 'else' (which is missing in XSLT). In XSLScript
+if-else is translated into appropriate xsl:choose-when-otherwise.
+XSLScript could get more 'non-xslt' semantics if you ask me for
+something you need.
 
 OK, but what is XSLScript ? 
 
@@ -117,32 +129,57 @@ X:template max( list ) {
 	
 Syntax overview
 
-Rather than drawing the mapping for all of 35 XSLT elements, I'l just provide the mapping rules. If this is not enough, please note that XSLScript distribution contains more than 10 examples of XSLScript code. Those examples are XSLT stylesheets from Michael Kay's XSLT Programming Reference (available for download from Wrox website) rewritten in XSLScript. This results in XSLScript examples being educational and covering almost every XSLT (XSLScript) command.
+Rather than drawing the mapping for all of 35 XSLT elements, I'l just
+provide the mapping rules. If this is not enough, please note that
+XSLScript distribution contains more than 10 examples of XSLScript code.
+Those examples are XSLT stylesheets from Michael Kay's XSLT Programming
+Reference (available for download from Wrox website) rewritten in
+XSLScript. This results in XSLScript examples being educational and
+covering almost every XSLT (XSLScript) command.
 
 Rules 
 
-There are top-level XSLScript constructions and instructions. (exactly like it is in XSLT). Instructions could be separated from the content with <% and %> ( 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 <!-- comments bugfixed.
-\{ bugfixed and \' allowed. This is actually not obvious, I should explain how to use \{ and \' ... some day ...
+\{ bugfixed and \' allowed. This is actually not obvious, I should
+explain how to use \{ and \' ... some day ...
 Few examples from XSL-list are included.
- 
 
-// Источник: http://pault.com/pault/XSLScript/
+###############################################################################
--- a/xslscript.pl
+++ b/xslscript.pl
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 
 # (C) Maxim Dounin
+# (C) Nginx, Inc.
 
 # Convert from XSLScript to XSLT.
 #