Project

Profile

Help

How to connect?
Download (17 KB) Statistics
| Branch: | Tag: | Revision:

he / tools / feature-matrix / feature-matrix-to-prod-desc.xsl @ 01d6fdb6

1
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:local="http://local-functions/"
3
    exclude-result-prefixes="xs local" version="2.0">
4
    
5
    <!-- Use this stylesheet to generate the output website/feature-matrix/prod-desc_9-x.xml
6
        (the source document for the product descriptions), 
7
        from the input website/feature-matrix/feature-matrix-src-9-x.xml-->
8

    
9
    <xsl:output method="xml" indent="yes"/>
10

    
11
    <xsl:param name="major-version"/>
12
    
13
    <xsl:variable name="edition" as="xs:string*" select="('HE', 'PE', 'EE', 'EE-T', 'EE-Q', 'EE-V')"/>
14
    <xsl:variable name="version" select="featureMatrix/@version"/>
15

    
16
    <xsl:template match="featureMatrix">
17
        <xsl:variable name="release-date" select="@release"/>
18
        <doc version="Version {$version} released {$release-date}">
19
            <xsl:text>&#xa;</xsl:text>
20
            <xsl:comment>Generated - <xsl:value-of select="current-dateTime()"/> from
21
                website/feature-matrix/feature-matrix-src-9-x.xml,
22
             using stylesheet website/feature-matrix/feature-matrix-to-prod-desc.xsl</xsl:comment>
23
            <xsl:text>&#xa;</xsl:text>
24
            <xsl:call-template name="header-section"/>
25
            <xsl:call-template name="doc-desc"/>
26
            <xsl:call-template name="footer-section"/>
27

    
28
            <h1 class="proddesc">Language Support</h1>
29
            <table class="feature-set" title="XSLT (Transformation Processing)">
30
                <tbody>
31
                    <xsl:call-template name="feature-sections">
32
                        <xsl:with-param name="topic" select="'XSLT'"/>
33
                    </xsl:call-template>
34
                </tbody>
35
            </table>
36
            <xsl:call-template name="language-section">
37
                <xsl:with-param name="topic" select="'XSLT'"/>
38
            </xsl:call-template>
39
            <table class="feature-set" title="XPath">
40
                <tbody>
41
                    <xsl:call-template name="feature-sections">
42
                        <xsl:with-param name="topic" select="'XPath'"/>
43
                    </xsl:call-template>
44
                </tbody>
45
            </table>
46
            <xsl:call-template name="language-section">
47
                <xsl:with-param name="topic" select="'XPath'"/>
48
            </xsl:call-template>
49
            <table class="feature-set" title="XQuery">
50
                <tbody>
51
                    <xsl:call-template name="feature-sections">
52
                        <xsl:with-param name="topic" select="'XQuery'"/>
53
                    </xsl:call-template>
54
                </tbody>
55
            </table>
56
            <xsl:call-template name="language-section">
57
                <xsl:with-param name="topic" select="'XQuery'"/>
58
            </xsl:call-template>
59
            <table class="feature-set"
60
                title="XSD (XML Schema Validation)">
61
                <tbody>
62
                    <xsl:call-template name="feature-sections">
63
                        <xsl:with-param name="topic" select="'XSD'"/>
64
                    </xsl:call-template>
65
                </tbody>
66
            </table>
67

    
68
            <h1 class="proddesc">
69
                <xsl:value-of select="'Performance Features'"/>
70
            </h1>
71
            <xsl:call-template name="feature-sections">
72
                <xsl:with-param name="topic" select="'Performance'"/>
73
            </xsl:call-template>
74
            <h1 class="proddesc">
75
                <xsl:value-of select="'Extensibility'"/>
76
            </h1>
77
            <xsl:call-template name="feature-sections">
78
                <xsl:with-param name="topic" select="'Extensibility'"/>
79
            </xsl:call-template>
80
            <h1 class="proddesc">
81
                <xsl:value-of select="'Localization'"/>
82
            </h1>
83
            <xsl:call-template name="feature-sections">
84
                <xsl:with-param name="topic" select="'Localization'"/>
85
            </xsl:call-template>
86
            <h1 class="proddesc">
87
                <xsl:value-of select="'Interfaces and APIs'"/>
88
            </h1>
89
            <xsl:call-template name="feature-sections">
90
                <xsl:with-param name="topic" select="'Interfaces'"/>
91
            </xsl:call-template>
92
        </doc>
93
    </xsl:template>
94

    
95
    <xsl:template name="feature-sections">
96
        <xsl:param name="topic"/>
97
        <xsl:for-each select="feature[@class eq $topic]/products/product[@editions]">
98
            <xsl:variable name="topic-shortName" select="ancestor::feature/shortName"/>
99
            <xsl:variable name="editions" select="@editions"/>
100
            <xsl:variable name="details" select="ancestor::feature/details"/>
101
            <xsl:variable name="spec" select="ancestor::feature/spec"/>
102
            <xsl:variable name="lang" select="ancestor::feature/@lang"/>
103
            <section
104
                title="{$topic-shortName}{if (exists(@level) and @level ne 'Inc') then concat(' (',local:prod-desc-level(@level),')') else ''}"
105
                variant="{$editions}">
106
                <!-- Feature descriptions may differ by product.
107
                    The primary mechanism for this is to use multiple products/product elements:
108
                    these result in multiple rows in the Feature Matrix table, as well as
109
                    alternative descriptions in the Product Descriptions.
110
                    The second mechanism is to use description/@editions and alt-description
111
                    elements. These will result in alternative descriptions in the PDs, but not in
112
                    the Feature Matrix. (e.g. used to add info for 'Import stylesheet packages' when
113
                    product does not also have 'Export' feature) -->
114
                <xsl:choose>
115
                    <xsl:when test="exists(./*)">
116
                        <xsl:copy-of select="./*"/>
117
                    </xsl:when>
118
                    <xsl:when test="ancestor::feature/description/@editions">
119
                        <xsl:variable name="feature" select="ancestor::feature"/>
120
                        <div variant="{$feature/description/@editions}">
121
                            <xsl:copy-of select="$feature/description/*"/>
122
                        </div>
123
                        <xsl:for-each select="$feature/alt-description">
124
                            <div variant="{./@editions}">
125
                                <xsl:copy-of select="./*"/>
126
                            </div>
127
                        </xsl:for-each>
128
                    </xsl:when>
129
                    <xsl:otherwise>
130
                        <xsl:copy-of select="ancestor::feature/description/*"/>
131
                    </xsl:otherwise>
132
                </xsl:choose>
133
                <!-- The details and spec links are the same for all (optional) features of the same
134
                    language (i.e. XSLT 3.0, XPath 3.1 and XQuery 3.1), and so do not need to be
135
                    repeated. These are included instead at the Language level using the
136
                    'language-section' template. -->
137
                <xsl:if test="empty($lang) and exists($details)">
138
                    <p>For more details see: <xsl:for-each select="$details">
139
                        <xsl:variable name="ext" select="if (./@subpages='has-subpages') then
140
                            '/index.html' else '.html'"/>
141
                        <xsl:variable name="documentation" select="if ($major-version=$version) then
142
                            'documentation' else concat('documentation',$version)"/>
143
                            <a href="http://www.saxonica.com/html/{$documentation}/{./@link}{$ext}"
144
                                class="bodylink"><xsl:value-of select="./@name"/></a>
145
                            <xsl:if test="not(position() = last())">
146
                                <xsl:text>, </xsl:text>
147
                            </xsl:if>
148
                        </xsl:for-each>. </p>
149
                    
150
                </xsl:if>
151
                <xsl:if test="empty($lang) and exists($spec)">
152
                    <p>
153
                        <xsl:text>Relevant W3C Specification: </xsl:text>
154
                        <a href="{$spec/@link}" class="bodylink">
155
                            <xsl:value-of
156
                                select="concat(($spec/@name, $topic-shortName)[1], ' ', $spec/@level, ' (', $spec/@date, ')')"
157
                            />
158
                        </a>.                        
159
                    </p>
160
                </xsl:if>
161
            </section>
162
        </xsl:for-each>
163
    </xsl:template>
164
    
165
    <xsl:template name="language-section">
166
        <xsl:param name="topic"/>
167
        <!-- Add a paragraph (conditional on edition variant) listing excluded features -->
168
        <xsl:variable name="features" select="feature[@class eq $topic]"/>
169
        <xsl:for-each select="$edition">
170
            <xsl:variable name="exclusions"
171
                select="$features[not(tokenize(products/product/@editions, '\s') = current())]"/>
172
            <xsl:if test="exists($exclusions)">
173
                <p variant="{.}">Optional features not provided:
174
                    <xsl:for-each select="$exclusions">
175
                        <xsl:value-of select="shortName"/>
176
                        <xsl:if test="not(position() = last())">
177
                            <xsl:text>, </xsl:text>
178
                        </xsl:if>
179
                    </xsl:for-each>.
180
                </p>
181
            </xsl:if>
182
        </xsl:for-each>
183
        <!-- Include details and spec links for the language (i.e. XSLT 3.0, XPath 3.1 and XQuery
184
            3.1) at this level. -->
185
        <xsl:variable name="details" select="$features[@lang][1]/details"/>
186
        <xsl:variable name="spec" select="$features[@lang][1]/spec"/>
187
        <xsl:if test="exists($details)">
188
            <p>For more details see: <xsl:for-each select="$details">
189
                <xsl:variable name="ext" select="if (./@subpages='has-subpages') then
190
                    '/index.html' else '.html'"/>
191
                <xsl:variable name="documentation" select="if ($major-version=$version) then
192
                    'documentation' else concat('documentation',$version)"/>
193
                <a href="http://www.saxonica.com/html/{$documentation}/{./@link}{$ext}"
194
                    class="bodylink"><xsl:value-of select="./@name"/></a>
195
                <xsl:if test="not(position() = last())">
196
                    <xsl:text>, </xsl:text>
197
                </xsl:if>
198
            </xsl:for-each>. </p>
199
        </xsl:if>
200
        <xsl:if test="exists($spec)">
201
            <p>
202
                <xsl:text>Relevant W3C Specification: </xsl:text>
203
                <a href="{$spec/@link}" class="bodylink">
204
                    <xsl:value-of
205
                        select="concat($spec/@name, ' ', $spec/@level, ' (', $spec/@date, ')')"
206
                    />
207
                </a>.                        
208
            </p>
209
        </xsl:if>
210
    </xsl:template>
211

    
212
    <xsl:template name="header-section">
213
        <section class="header">
214
            <table>
215
                <tbody>
216
                    <tr>
217
                        <td class="important">
218
                            <xsl:for-each select="$edition">
219
                                <title variant="{.}">
220
                                    <xsl:value-of select="concat('Product Description for ', local:edition-name(.))"/>
221
                                </title>
222
                            </xsl:for-each>
223
                        </td>
224
                        <td>
225
                            <p class="right">
226
                                <img src="../../saxonica_logo.gif"/>
227
                                <br/>
228
                                <!--<span value="$timestamp"/>
229
              <br/>-->
230
                                <span value="$version"/>
231
                                <!-- This is an example of doing a page number - 
232
        the use-when="PDF" means it will only appear in the PDF version
233
        Normal styling can be achieved through CSS, 
234
        but the <page-number/> substitute doesn't have any properties - use <span> around to style.
235
        To change the page number format itself look in config.xml
236
      -->
237
                                <span class="page-number" use-when="PDF">
238
                                    <br/>Page <page-number/>/<total-pages/></span>
239
                            </p>
240
                        </td>
241
                    </tr>
242
                </tbody>
243
            </table>
244
        </section>
245
    </xsl:template>
246

    
247
    <xsl:template name="doc-desc">
248
        <!-- do we need any caveats here about what product description conforms to?-->     
249
        
250
        <!-- This document lists the features that Saxon-X supports, and describes the level of that support.-->
251
        <!-- This document lists the features supported by Saxon-X, and describes the level of that support.-->
252
        <!-- This document lists the features provided by Saxon 9.x -X.-->   
253
        <xsl:for-each select="$edition">
254
            <p variant="{.}">
255
                <xsl:value-of select="concat('This document lists the features provided by Saxon ',
256
                    $version, ' ', local:edition-desc(.), '.')"/>
257
            </p>
258
        </xsl:for-each>
259
        <p>This document does not form part of any contract unless expressly incorporated.</p>
260
    </xsl:template>
261

    
262
    <xsl:template name="footer-section">
263
        <section class="footer">
264
            <hr/>
265
            <table>
266
                <tbody>
267
                    <tr>
268
                        <xsl:for-each select="$edition">
269
                            <td class="footerName" variant="{.}">
270
                                <xsl:value-of select="concat('Product Description for ', local:edition-name(.))"/>
271
                            </td>
272
                        </xsl:for-each>
273
                        <td class="copyright right">
274
                            <xsl:value-of select="concat('© Saxonica Ltd. ', format-dateTime(current-dateTime(),'[Y]'))"/>
275
                        </td>
276
                    </tr>
277
                </tbody>
278
            </table>
279
        </section>
280
    </xsl:template>
281
    
282
    <xsl:function name="local:edition-name" as="xs:string">
283
        <xsl:param name="edition" as="xs:string"/>
284
        <xsl:choose>
285
            <xsl:when test="$edition = 'HE'">Saxon-HE (Home Edition)</xsl:when>
286
            <xsl:when test="$edition = 'PE'">Saxon-PE (Professional Edition)</xsl:when>
287
            <xsl:when test="$edition = 'EE'">Saxon-EE (Enterprise Edition)</xsl:when>
288
            <xsl:when test="$edition = 'EE-T'">Saxon-EE-T (Enterprise Edition, Transformation Package)</xsl:when>
289
            <xsl:when test="$edition = 'EE-Q'">Saxon-EE-Q (Enterprise Edition, Query Package)</xsl:when>
290
            <xsl:when test="$edition = 'EE-V'">Saxon-EE-V (Enterprise Edition, Validation Package)</xsl:when>
291
            <xsl:otherwise>
292
                <xsl:value-of select="'&#xa0;'"/>
293
            </xsl:otherwise>
294
        </xsl:choose>
295
    </xsl:function>
296
    
297
    <xsl:function name="local:edition-desc" as="xs:string">
298
        <xsl:param name="edition" as="xs:string"/>
299
        <xsl:choose>
300
            <xsl:when test="$edition = 'HE'">open source Home Edition (Saxon-HE)</xsl:when>
301
            <xsl:when test="$edition = 'PE'">Professional Edition (Saxon-PE)</xsl:when>
302
            <xsl:when test="$edition = 'EE'">Enterprise Edition (Saxon-EE)</xsl:when>
303
            <xsl:when test="$edition = 'EE-T'">Enterprise Edition, Transformation Package 
304
                (Saxon-EE-T) - a license that enables all the facilities of Saxon Professional
305
                Edition, plus XSD schema validation, plus enterprise features (including Schema
306
                Awareness) for XSLT (but not XQuery)</xsl:when>
307
            <xsl:when test="$edition = 'EE-Q'">Enterprise Edition, Query Package 
308
                (Saxon-EE-Q) - a license that enables all the facilities of Saxon Professional
309
                Edition, plus XSD schema validation, plus enterprise features (including Schema
310
                Awareness) for XQuery (but not XSLT)</xsl:when>
311
            <xsl:when test="$edition = 'EE-V'">Enterprise Edition, Validation Package 
312
                (Saxon-EE-V) - a license that enables all the facilities of Saxon Professional
313
                Edition, plus XSD schema validation; it does not include Schema Aware XSLT or
314
                XQuery</xsl:when>
315
            <xsl:otherwise>
316
                <xsl:value-of select="'&#xa0;'"/>
317
            </xsl:otherwise>
318
        </xsl:choose>
319
    </xsl:function>
320

    
321
    <xsl:function name="local:prod-desc-level" as="xs:string">
322
        <xsl:param name="level" as="xs:string?"/>
323
        <xsl:choose>
324
            <xsl:when test="contains($level, 'Adv')">Advanced</xsl:when>
325
            <xsl:when test="contains($level, 'SA') and contains($level, 'Strm')">Schema Aware &amp; Streaming</xsl:when>
326
            <xsl:when test="contains($level, 'SA')">Schema Aware</xsl:when>
327
            <xsl:when test="contains($level, 'HOF')">Higher-Order Functions</xsl:when>
328
            <xsl:when test="contains($level, 'Basic')">Basic</xsl:when>
329
            <xsl:when test="contains($level, 'Open')">not included, but open source</xsl:when>
330
            <xsl:when test="contains($level, 'Inc')">Included</xsl:when>
331
            <xsl:otherwise>
332
                <xsl:value-of select="'&#xa0;'"/>
333
            </xsl:otherwise>
334
        </xsl:choose>
335
    </xsl:function>
336

    
337
</xsl:stylesheet>
(3-3/3)