Mercurial > hg > xslscript
annotate README @ 10:cb41e7c634c5
XSLScript: README and LICENSE.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 27 Feb 2014 21:19:33 +0400 |
parents | xslscript.txt@d3340fdeadf6 |
children |
rev | line source |
---|---|
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
1 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
2 This code is a replacement for XSLScript, previously available from |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
3 http://pault.com/pault/XSLScript/. It is not recommended for general |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
4 use, but rather a replacement for what is used by nginx. |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
5 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
6 Snapshot of the original XSLScript documentation is given below, |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
7 as recovered from: |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 http://moemesto.ru/link/6865082 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
10 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 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
12 ############################################################################### |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 Since Year 2000 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
15 Version 0.7 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 Check out TerseXML project |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
17 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
18 XSLScript is for those, who are writing complex XSLT stylesheets. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
19 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
20 XSLScript is a terse notation for writing complex XSLT stylesheets. |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
21 XSLScript is part of Hiawatha web-server, but XSLScript also can be |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
22 used stand-alone. |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 To execute XSLScript script: |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 xsls some.xml some.xsls |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
27 |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
28 The XSLScript script (some.xsls) gets compiled into corresponding XSLT |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
29 stylesheet and then generated XSLT stylesheet is applied to the file |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
30 some.xml (no temporary .xsl file is created, this all happens in the |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
31 memory). The actual XSLT tranformation is performed by SAXON. There is |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
32 1-1 lines mapping between XSLScript script and generated XSLT ( this |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
33 means if some XSLScript construction starts on line 5, the corresponding |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
34 XSLT construction will also start on the same line 5. ) |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
35 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
36 To generate the XSLT stylesheet out of XSLScript script: |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
37 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 xslsdump some.xsls |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 or |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
40 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
41 xslsdump-indent some.xsls |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
42 if you want a nice looking indentation. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
43 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
44 Why XSLScript ? |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
45 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
46 XSLT syntax is not for human beings. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
47 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
48 One can write complex XSLT code in XSLScript and then generate the 100% |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
49 XSLT stylesheet. Like I do. Occasionaly. |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
50 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 Can I use my XSLT stylesheets with XSLScript? |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
52 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
53 You can use xsl:import / xsl:include to include .xsl into .xsls and to |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
54 include .xsls into .xsl. |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
55 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
56 What if I like writing <xsl:something? |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
57 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
58 You can write XSLT instructions in plain XSLT, XSLScript preprocessor |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
59 will not touch them and will pass those constructions as-is. |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
60 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
61 Top-level elements should be plain XSLScript. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
62 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
63 What is XSLScript ? |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
64 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
65 XSLScript is just syntax sugar, 1-1 mapping of XSLT. The only exception |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
66 is that XSLScript has 'else' (which is missing in XSLT). In XSLScript |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
67 if-else is translated into appropriate xsl:choose-when-otherwise. |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
68 XSLScript could get more 'non-xslt' semantics if you ask me for |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
69 something you need. |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
70 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
71 OK, but what is XSLScript ? |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
72 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 Snippet 1 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
75 X:stylesheet { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
77 X:template = "poem" { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
78 <html> |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
79 <head> |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
80 <title> !{title} </title> |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
81 </head> |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
82 <body> |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 !! "title"; |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
84 !! "author"; |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 X:apply-templates "stanza"; |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 X:apply-templates "date"; |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 </body> |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
88 </html> |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
90 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
91 X:template = "title" { <div align="center"><h1> !{.} </h1></div> } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 X:template = "author" { <div align="center"><h2> By <% !{.} %> </h2></div> } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
93 X:template = "stanza" { <p> !! "line"; </p> } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
94 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
95 X:template = "line" { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
96 X:if "position() mod 2 = 0" {  } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
97 !{.} <br/> |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
98 } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
99 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
100 X:template = "date" { <p><i> !{.} </i></p> } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
101 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
102 } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
103 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
104 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
105 Snippet 2 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
106 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
107 X:transform { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
108 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 X:template max( list ) { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
110 X:if "$list" { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 X:variable first="count($list[1]/LINE)" |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 X:variable max-of-rest={ !max( list="$list[position()!=1]" ) } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
113 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
114 X:if "$first > $max-of-rest" { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 !{$first} |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
116 } else { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 !{$max-of-rest} |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 } else { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 0 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
121 } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
122 } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
123 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
124 X:template ="/" { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 Longest speech is <% X:text; !max( list="//SPEECH" ) X:text; %> lines. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
127 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
128 } |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
129 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
130 Syntax overview |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
131 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
132 Rather than drawing the mapping for all of 35 XSLT elements, I'l just |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
133 provide the mapping rules. If this is not enough, please note that |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
134 XSLScript distribution contains more than 10 examples of XSLScript code. |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
135 Those examples are XSLT stylesheets from Michael Kay's XSLT Programming |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
136 Reference (available for download from Wrox website) rewritten in |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
137 XSLScript. This results in XSLScript examples being educational and |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
138 covering almost every XSLT (XSLScript) command. |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
139 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
140 Rules |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
141 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
142 There are top-level XSLScript constructions and instructions. (exactly |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
143 like it is in XSLT). Instructions could be separated from the content |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
144 with <% and %> ( optional ). |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
145 |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
146 Instruction has body and header. Body is separated from header with { } |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
147 'match', 'select', 'test' and 'name' are not written (but also could be |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
148 written in some exotic cases.) |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
149 |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
150 Symbols ', ", {, are special. Use \{ e t.c. if you need those special |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
151 symbols in tne content of your stylesheet. |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
152 |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
153 xsl:apply-templates, !! and xsl:number should end with ";" |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
154 |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
155 Syntax of apply-templates is extremely close to the syntax of |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
156 call-template. |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
157 |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
158 There are few shortcuts: |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
159 You can use !{xpath-expression} for |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
160 X:value-of select="xpath-expression"; |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
161 !! for X:apply-templates |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
162 !foo() for X:call-template name="foo" |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
163 X:var for X:variable |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
164 |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
165 There is 'comma' shortcut. It exists for X:stylesheet (see date.xsls for |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
166 example of XSLT-engine independent java binding). And also it exists for |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
167 X:for-each and X:apply-templates. |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
168 |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
169 X:for-each "//*" , X:sort { |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
170 |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
171 You can not write X:sort as an element, but you should use 'comma' |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
172 shortcut. |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
173 |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
174 The shortcut for template allows : |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
175 X:template foo( bar="init", baz={markup} ) = "match" mode="some" { |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
176 Download |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
177 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
178 Because SAXON (http://users.iclway.co.uk/mhkay/saxon/) is 100% free, |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
179 XSLScript distribution contains everything you need to run XSLScript. |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
180 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
181 xsls.jar includes not only .class files, but also the source code of |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
182 XSLScript |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
183 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
184 XSLScript is 100% free. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
185 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
186 Contact |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
187 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
188 Paul Tchistopolskii. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
189 http://www.pault.com |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
190 paul@pault.com |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
191 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
192 Changes in version 0.7 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
193 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
194 (major rewrite) |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
195 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
196 <% %> are optional. |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
197 Some verbose forms are dropped ( no X:with-param and call-template ever, |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
198 e t.c. ) |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
199 Parser is less forgiving and some things become not intuitive. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
200 \{ \' " required. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
201 Nice dumping of generated stylesheet. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
202 1-1 line mapping. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
203 Based on SAXON / SAX2, but still should work with XT. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
204 Changes in version 0.51 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
205 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
206 (small bugfixes) |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
207 |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
208 ':' was not allowed in #NAME token. ( Allows xmlns:some= ) |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
209 Multiple <!-- comments bugfixed. |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
210 \{ bugfixed and \' allowed. This is actually not obvious, I should |
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
211 explain how to use \{ and \' ... some day ... |
0
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
212 Few examples from XSL-list are included. |
c9be645cc395
XSLScript: added some description found.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
213 |
10
cb41e7c634c5
XSLScript: README and LICENSE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6
diff
changeset
|
214 ############################################################################### |