source: rfc2629xslt/xslt-test.xslt @ 1072

Last change on this file since 1072 was 1072, checked in by julian.reschke@…, 12 years ago

bump up document dates, update to latest version of rfc2629.xslt

  • Property svn:eol-style set to native
File size: 6.5 KB
Line 
1<!--
2    XSLT test cases
3
4    Copyright (c) 2007-2010, Julian Reschke (julian.reschke@greenbytes.de)
5    All rights reserved.
6
7    Redistribution and use in source and binary forms, with or without
8    modification, are permitted provided that the following conditions are met:
9
10    * Redistributions of source code must retain the above copyright notice,
11      this list of conditions and the following disclaimer.
12    * Redistributions in binary form must reproduce the above copyright notice,
13      this list of conditions and the following disclaimer in the documentation
14      and/or other materials provided with the distribution.
15    * Neither the name of Julian Reschke nor the names of its contributors
16      may be used to endorse or promote products derived from this software
17      without specific prior written permission.
18
19    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29    POSSIBILITY OF SUCH DAMAGE.
30-->
31
32<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33                version="1.0"
34                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
35                xmlns:exslt="http://exslt.org/common"
36                xmlns:date="http://exslt.org/dates-and-times"
37                exclude-result-prefixes="msxsl exslt">
38
39<xsl:output method="html" encoding="iso-8859-1" version="4.0" doctype-public="-//W3C//DTD HTML 4.01//EN" indent="no"/>
40
41<xsl:template match="/">
42  <html>
43    <head>
44      <title>XSLT test cases</title>
45      <style type="text/css">
46        body {
47          font-family: verdana, helvetica, arial, sans-serif;
48          font-size: 10pt;
49        }
50        td {
51          text-align: left;
52        }
53        th {
54          text-align: left;
55        }
56        h1 {
57          font-size: 14pt;
58        }
59        h2 {
60          font-size: 12pt;
61        }
62        .green {
63          color: green;
64        }
65        .red {
66          color: red;
67        }
68      </style>
69    </head>
70    <body>
71      <h1>XSLT test cases</h1>
72     
73      <xsl:call-template name="info"/>
74      <xsl:call-template name="nodeset"/>
75      <xsl:call-template name="whitespace-treatment"/>
76      <xsl:call-template name="date-time"/>
77    </body>
78  </html>
79</xsl:template>
80
81<xsl:template name="info">
82  <h2 id="engine.information">Engine Information</h2>
83
84  <table>
85    <thead>
86      <tr>
87        <th><a href="http://www.w3.org/TR/xslt#function-system-property">System Property</a></th>
88        <th>Value</th>
89      </tr>
90    </thead>
91    <tbody>
92      <tr>
93        <td>
94          <code>
95            xsl:version
96          </code>
97        </td>
98        <td>
99          <tt>
100            <xsl:value-of select="system-property('xsl:version')"/>
101          </tt>
102        </td>
103      </tr>
104      <tr>
105        <td>
106          <code>
107            xsl:vendor
108          </code>
109        </td>
110        <td>
111          <tt>
112            <xsl:value-of select="system-property('xsl:vendor')"/>
113          </tt>
114        </td>
115      </tr>
116      <tr>
117        <td>
118          <code>
119            xsl:vendor-url
120          </code>
121        </td>
122        <td>
123          <tt>
124            <a href="{system-property('xsl:vendor-url')}"><xsl:value-of select="system-property('xsl:vendor-url')"/></a>
125          </tt>
126        </td>
127      </tr>
128      <tr>
129        <td>
130          <code>
131            msxsl:version
132          </code>
133        </td>
134        <td>
135          <tt>
136            <xsl:value-of select="system-property('msxsl:version')"/>
137          </tt>
138        </td>
139      </tr>
140    </tbody>
141  </table>
142</xsl:template>
143
144<xsl:template name="nodeset">
145  <h2 id="node-set">Node-Set Support</h2>
146 
147  <table>
148    <thead>
149      <tr>
150        <th>Nodeset Extension</th>
151        <th>Available?</th>
152      </tr>
153    </thead>
154    <tbody>
155      <tr>
156        <td>
157          <code>
158            <a href="http://www.exslt.org/exsl/functions/node-set/exsl.node-set.html">exslt:node-set</a>
159          </code>
160        </td>
161        <td>
162          <xsl:choose>
163            <xsl:when test="function-available('exslt:node-set')">
164              <div class="green">Yes</div>
165            </xsl:when>
166            <xsl:otherwise>
167              <div class="red">No</div>
168            </xsl:otherwise>
169          </xsl:choose>
170        </td>
171      </tr>
172      <tr>
173        <td>
174          <code>
175            <a href="http://msdn2.microsoft.com/en-us/library/ms256197.aspx">msxsl:node-set</a>
176          </code>
177        </td>
178        <td>
179          <xsl:choose>
180            <xsl:when test="function-available('msxsl:node-set')">
181              <div class="green">Yes</div>
182            </xsl:when>
183            <xsl:otherwise>
184              No
185            </xsl:otherwise>
186          </xsl:choose>
187        </td>
188      </tr>
189    </tbody>
190  </table>
191</xsl:template>
192
193<xsl:template name="whitespace-treatment">
194  <h2 id="whitespace">Whitespace Treatment</h2>
195
196  <p>
197    Whitespace between elements is respected:
198    <xsl:choose>
199      <xsl:when test="/*/whitespace-test[@id='ws-def']/text()">
200        <span class="green">Yes</span>
201      </xsl:when>
202      <xsl:otherwise>
203        <span class="red">No</span>
204      </xsl:otherwise>
205    </xsl:choose>
206  </p>
207  <p>
208    Whitespace between elements respected when xml:space='preserved' :
209    <xsl:choose>
210      <xsl:when test="/*/whitespace-test[@id='ws-pres']/text()">
211        <span class="green">Yes</span>
212      </xsl:when>
213      <xsl:otherwise>
214        <span class="red">No</span>
215      </xsl:otherwise>
216    </xsl:choose>
217  </p>
218</xsl:template>
219
220<xsl:template name="date-time">
221  <h2 id="date-time">Date-Time Support</h2>
222 
223  <p>
224    <code>
225      <a href="http://www.exslt.org/date/functions/date-time/">exslt:date-time()</a>
226    </code>:
227    <xsl:choose>
228      <xsl:when test="function-available('date:date-time')">
229        <span class="green">Yes</span>, and returns: <xsl:value-of select="date:date-time()"/>
230      </xsl:when>
231      <xsl:otherwise>
232        <span class="red">No</span>
233      </xsl:otherwise>
234    </xsl:choose>
235  </p>
236</xsl:template>
237
238</xsl:transform>
Note: See TracBrowser for help on using the repository browser.