1 | <!--
|
---|
2 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | contributor license agreements. See the NOTICE file distributed with
|
---|
4 | this work for additional information regarding copyright ownership.
|
---|
5 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | (the "License"); you may not use this file except in compliance with
|
---|
7 | the License. You may obtain a copy of the License at
|
---|
8 |
|
---|
9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 |
|
---|
11 | Unless required by applicable law or agreed to in writing, software
|
---|
12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | See the License for the specific language governing permissions and
|
---|
15 | limitations under the License.
|
---|
16 | -->
|
---|
17 | <html>
|
---|
18 |
|
---|
19 | <head>
|
---|
20 | <meta http-equiv="Content-Language" content="en-us">
|
---|
21 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
22 | <title>XSLT Task</title>
|
---|
23 | </head>
|
---|
24 |
|
---|
25 | <body>
|
---|
26 |
|
---|
27 | <h2><a name="style">XSLT</a></h2>
|
---|
28 | <p><em>The name <code>style</code> is a deprecated name for the same task.</em></p>
|
---|
29 | <h3>Description</h3>
|
---|
30 | <p>Process a set of documents via XSLT.</p>
|
---|
31 | <p>This is useful for building views of XML based documentation,
|
---|
32 | or for generating code.</p>
|
---|
33 | <p><b>Note:</b> If you are using JDK 1.4 or higher, this task does not require external libraries
|
---|
34 | not supplied in the Ant distribution. However, often the built in XSL engine is not as up
|
---|
35 | to date as a fresh download, so an update is still highly recommended.
|
---|
36 | See <a href="../install.html#librarydependencies">Library Dependencies</a> for more information.</p>
|
---|
37 | <p>It is possible to refine the set of files that are being processed. This can be
|
---|
38 | done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
|
---|
39 | attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
|
---|
40 | have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
|
---|
41 | the files you want to have excluded. This is also done with patterns. And
|
---|
42 | finally with the <i>defaultexcludes</i> attribute, you can specify whether you
|
---|
43 | want to use default exclusions or not. See the section on <a
|
---|
44 | href="../dirtasks.html#directorybasedtasks">directory based tasks</a>, on how the
|
---|
45 | inclusion/exclusion of files works, and how to write patterns.</p>
|
---|
46 | <p>This task forms an implicit <a href="../CoreTypes/fileset.html">FileSet</a> and supports all
|
---|
47 | attributes of <code><fileset></code> (<code>dir</code> becomes <code>basedir</code>)
|
---|
48 | as well as the nested <code><include></code>, <code><exclude></code>
|
---|
49 | and <code><patternset></code> elements.</p>
|
---|
50 |
|
---|
51 | <p><b>Note</b>: Unlike other similar tasks, this task treats
|
---|
52 | directories that have been matched by the include/exclude patterns of
|
---|
53 | the implicit fileset in a special way. It will apply the stylesheets
|
---|
54 | to all files contain in them as well. Since the default include
|
---|
55 | pattern is <code>**</code> this means it will apply the stylesheet to
|
---|
56 | all files. If you specify an excludes pattern, it may still work on
|
---|
57 | the files matched by those patterns because the parent directory has
|
---|
58 | been matched. If this behavior is not what you want, set the
|
---|
59 | scanincludedirectories attribute to false.</p>
|
---|
60 |
|
---|
61 | <p>Starting with Ant 1.7 this task supports nested <a
|
---|
62 | href="../CoreTypes/resources.html#collection">resource collection</a>s
|
---|
63 | in addition to (or instead of, depending on the useImplicitFileset
|
---|
64 | attribute) the implicit fileset formed by this task.</p>
|
---|
65 |
|
---|
66 | <p>This task supports the use of a nested <code><param></code> element which is used to pass values
|
---|
67 | to an <code><xsl:param></code> declaration.</p>
|
---|
68 | <p>This task supports the use of a nested <a href="../CoreTypes/xmlcatalog.html">xmlcatalog</a>
|
---|
69 | element which is used to perform Entity and URI resolution.</p>
|
---|
70 | <h3>Parameters</h3>
|
---|
71 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
72 | <tr>
|
---|
73 | <td valign="top"><b>Attribute</b></td>
|
---|
74 | <td valign="top"><b>Description</b></td>
|
---|
75 | <td align="center" valign="top"><b>Required</b></td>
|
---|
76 | </tr>
|
---|
77 | <tr>
|
---|
78 | <td valign="top">basedir</td>
|
---|
79 | <td valign="top">where to find the source XML file, default is the
|
---|
80 | project's basedir.</td>
|
---|
81 | <td align="center" valign="top">No</td>
|
---|
82 | </tr>
|
---|
83 | <tr>
|
---|
84 | <td valign="top">destdir</td>
|
---|
85 | <td valign="top">directory in which to store the results.</td>
|
---|
86 | <td align="center" valign="top">Yes, unless in and out have been
|
---|
87 | specified.</td>
|
---|
88 | </tr>
|
---|
89 | <tr>
|
---|
90 | <td valign="top">extension</td>
|
---|
91 | <td valign="top">desired file extension to be used for the targets. If not
|
---|
92 | specified, the default is ".html". Will be ignored if
|
---|
93 | a nested <code><mapper></code> has been specified.</td>
|
---|
94 | <td align="center" valign="top">No</td>
|
---|
95 | </tr>
|
---|
96 | <tr>
|
---|
97 | <td valign="top">style</td>
|
---|
98 | <td valign="top">name of the stylesheet to use - given either relative
|
---|
99 | to the project's basedir or as an absolute path.<br/>
|
---|
100 | <br/>
|
---|
101 | Alternatively, a nested element which ant can interpret as a resource
|
---|
102 | can be used to indicate where to find the stylesheet<br/>
|
---|
103 | <em>deprecated variation :</em> <br/>
|
---|
104 | If the stylesheet cannot be found, and if you have specified the
|
---|
105 | attribute basedir for the task, ant will assume that the style
|
---|
106 | attribute is relative to the basedir of the task.
|
---|
107 | </td>
|
---|
108 | <td align="center" valign="top">No, if the location of
|
---|
109 | the stylesheet is specified using a nested <style> element</td>
|
---|
110 | </tr>
|
---|
111 | <tr>
|
---|
112 | <td valign="top">classpath</td>
|
---|
113 | <td valign="top">the classpath to use when looking up the XSLT
|
---|
114 | processor.</td>
|
---|
115 | <td align="center" valign="top">No</td>
|
---|
116 | </tr>
|
---|
117 | <tr>
|
---|
118 | <td valign="top">classpathref</td>
|
---|
119 | <td valign="top">the classpath to use, given as <a
|
---|
120 | href="../using.html#references">reference</a> to a path defined elsewhere.</td>
|
---|
121 | <td align="center" valign="top">No</td>
|
---|
122 | </tr>
|
---|
123 | <tr>
|
---|
124 | <td valign="top">force</td>
|
---|
125 | <td valign="top">Recreate target files, even if they are newer
|
---|
126 | than their corresponding source files or the stylesheet.</td>
|
---|
127 | <td valign="top" align="center">No; default is false</td>
|
---|
128 | </tr>
|
---|
129 | <tr>
|
---|
130 | <td valign="top">processor</td>
|
---|
131 |
|
---|
132 | <td valign="top">name of the XSLT processor to use.
|
---|
133 | Permissible value is :<ul>
|
---|
134 | <li>"trax" for a TraX compliant processor (ie JAXP interface
|
---|
135 | implementation such as Xalan 2 or Saxon)</li></ul>
|
---|
136 | Defaults to trax.
|
---|
137 | <br/>
|
---|
138 | Support for xalan1 has been removed in ant 1.7.
|
---|
139 | </td>
|
---|
140 | <td align="center" valign="top">No</td>
|
---|
141 | </tr>
|
---|
142 | <tr>
|
---|
143 | <td valign="top">includes</td>
|
---|
144 | <td valign="top">comma- or space-separated list of patterns of files that must be included.
|
---|
145 | All files are included when omitted.</td>
|
---|
146 | <td valign="top" align="center">No</td>
|
---|
147 | </tr>
|
---|
148 | <tr>
|
---|
149 | <td valign="top">includesfile</td>
|
---|
150 | <td valign="top">the name of a file. Each line of this file is taken to be
|
---|
151 | an include pattern</td>
|
---|
152 | <td valign="top" align="center">No</td>
|
---|
153 | </tr>
|
---|
154 | <tr>
|
---|
155 | <td valign="top">excludes</td>
|
---|
156 | <td valign="top">comma- or space-separated list of patterns of files that must be excluded.
|
---|
157 | No files (except default excludes) are excluded when omitted.</td>
|
---|
158 | <td valign="top" align="center">No</td>
|
---|
159 | </tr>
|
---|
160 | <tr>
|
---|
161 | <td valign="top">excludesfile</td>
|
---|
162 | <td valign="top">the name of a file. Each line of this file is taken to be
|
---|
163 | an exclude pattern</td>
|
---|
164 | <td valign="top" align="center">No</td>
|
---|
165 | </tr>
|
---|
166 | <tr>
|
---|
167 | <td valign="top">defaultexcludes</td>
|
---|
168 | <td valign="top">indicates whether default excludes should be used or not
|
---|
169 | ("yes"/"no"). Default excludes are used when omitted.</td>
|
---|
170 | <td valign="top" align="center">No</td>
|
---|
171 | </tr>
|
---|
172 | <tr>
|
---|
173 | <td valign="top">in</td>
|
---|
174 | <td valign="top">specifies a single XML document to be styled. Should be used
|
---|
175 | with the out attribute.</td>
|
---|
176 | <td valign="top" align="center">No</td>
|
---|
177 | </tr>
|
---|
178 | <tr>
|
---|
179 | <td valign="top">out</td>
|
---|
180 | <td valign="top">specifies the output name for the styled result from the
|
---|
181 | in attribute.</td>
|
---|
182 | <td valign="top" align="center">No</td>
|
---|
183 | </tr>
|
---|
184 | <tr>
|
---|
185 | <td valign="top">scanincludeddirectories</td>
|
---|
186 | <td valign="top">If any directories are matched by the
|
---|
187 | includes/excludes patterns, try to transform all files in these
|
---|
188 | directories. Default is <code>true</code></td>
|
---|
189 | <td valign="top" align="center">No</td>
|
---|
190 | </tr>
|
---|
191 | <tr>
|
---|
192 | <td valign="top">reloadstylesheet</td>
|
---|
193 | <td valign="top">Control whether the stylesheet transformer is created
|
---|
194 | anew for every transform opertaion. If you set this to true, performance may
|
---|
195 | suffer, but you may work around a bug in certain Xalan-J versions.
|
---|
196 | Default is <code>false</code>. <em>Since Ant 1.5.2</em>.</td>
|
---|
197 | <td valign="top" align="center">No</td>
|
---|
198 | </tr>
|
---|
199 | <tr>
|
---|
200 | <td valign="top">useImplicitFileset</td>
|
---|
201 | <td valign="top">Whether the implicit fileset formed by this task
|
---|
202 | shall be used. If you set this to false you must use nested
|
---|
203 | resource collections - or the in attribute, in which case this
|
---|
204 | attribute has no impact anyway. Default is <code>true</code>.
|
---|
205 | <em>Since Ant 1.7</em>.</td>
|
---|
206 | <td valign="top" align="center">No</td>
|
---|
207 | </tr>
|
---|
208 | <tr>
|
---|
209 | <td valign="top">filenameparameter</td>
|
---|
210 | <td valign="top">Specifies a xsl parameter for accessing the name
|
---|
211 | of the current processed file. If not set, the file name is not
|
---|
212 | passed to the transformation.
|
---|
213 | <em>Since Ant 1.7</em>.</td>
|
---|
214 | <td valign="top" align="center">No</td>
|
---|
215 | </tr>
|
---|
216 | <tr>
|
---|
217 | <td valign="top">filedirparameter</td>
|
---|
218 | <td valign="top">Specifies a xsl parameter for accessing the directory
|
---|
219 | of the current processed file. For files in the current directory a
|
---|
220 | value of '.' will be passed to the transformation.
|
---|
221 | If not set, the directory is not passed to the transformation.
|
---|
222 | <em>Since Ant 1.7</em>.</td>
|
---|
223 | <td valign="top" align="center">No</td>
|
---|
224 | </tr>
|
---|
225 | </table>
|
---|
226 | <h3>Parameters specified as nested elements</h3>
|
---|
227 |
|
---|
228 | <h4>any <a href="../CoreTypes/resources.html#collection">resource
|
---|
229 | collection</a></h4>
|
---|
230 |
|
---|
231 | <p><em>since Ant 1.7</em></p>
|
---|
232 |
|
---|
233 | <p>Use resource collections to specify resources that the stylesheet
|
---|
234 | should be applied to. Use a nested mapper and the task's destdir
|
---|
235 | attribute to specify the output files.</p>
|
---|
236 |
|
---|
237 | <h4>classpath</h4>
|
---|
238 | <p>The classpath to load the processor from can be specified via a
|
---|
239 | nested <code><classpath></code>, as well - that is, a
|
---|
240 | <a href="../using.html#path">path</a>-like structure.</p>
|
---|
241 |
|
---|
242 | <h4>xmlcatalog</h4>
|
---|
243 | <p>The <a href="../CoreTypes/xmlcatalog.html">xmlcatalog</a>
|
---|
244 | element is used to perform Entity and URI resolution.</p>
|
---|
245 |
|
---|
246 | <h4>param</h4>
|
---|
247 | <p>Param is used to pass a parameter to the XSL stylesheet.</p>
|
---|
248 | <blockquote>
|
---|
249 | <h4>Parameters</h4>
|
---|
250 | <table width="60%" border="1" cellpadding="2" cellspacing="0">
|
---|
251 | <tr>
|
---|
252 | <td valign="top"><b>Attribute</b></td>
|
---|
253 | <td valign="top"><b>Description</b></td>
|
---|
254 | <td align="center" valign="top"><b>Required</b></td>
|
---|
255 | </tr>
|
---|
256 | <tr>
|
---|
257 | <td valign="top">name</td>
|
---|
258 | <td valign="top">Name of the XSL parameter</td>
|
---|
259 | <td align="center" valign="top">Yes</td>
|
---|
260 | </tr>
|
---|
261 | <tr>
|
---|
262 | <td valign="top">expression</td>
|
---|
263 | <td valign="top">Text value to be placed into the param.<br>
|
---|
264 | Was originally intended to be an XSL expression.</td>
|
---|
265 | <td align="center" valign="top">Yes</td>
|
---|
266 | </tr>
|
---|
267 | <tr>
|
---|
268 | <td valign="top">if</td>
|
---|
269 | <td valign="top">The param will only passed if this property is set.</td>
|
---|
270 | <td align="center" valign="top">No</td>
|
---|
271 | </tr>
|
---|
272 | <tr>
|
---|
273 | <td valign="top">unless</td>
|
---|
274 | <td valign="top">The param will only passed unless this property is set.</td>
|
---|
275 | <td align="center" valign="top">No</td>
|
---|
276 | </tr>
|
---|
277 |
|
---|
278 | </table>
|
---|
279 | </blockquote>
|
---|
280 |
|
---|
281 | <h4>outputproperty ('trax' processors only)</h4>
|
---|
282 | <p>Used to specify how you wish the result tree to be output
|
---|
283 | as specified in the <a href="http://www.w3.org/TR/xslt#output">
|
---|
284 | XSLT specifications</a>.
|
---|
285 | <blockquote>
|
---|
286 | <h4>Parameters</h4>
|
---|
287 | <table width="60%" border="1" cellpadding="2" cellspacing="0">
|
---|
288 | <tr>
|
---|
289 | <td valign="top"><b>Attribute</b></td>
|
---|
290 | <td valign="top"><b>Description</b></td>
|
---|
291 | <td align="center" valign="top"><b>Required</b></td>
|
---|
292 | </tr>
|
---|
293 | <tr>
|
---|
294 | <td valign="top">name</td>
|
---|
295 | <td valign="top">Name of the property</td>
|
---|
296 | <td align="center" valign="top">Yes</td>
|
---|
297 | </tr>
|
---|
298 | <tr>
|
---|
299 | <td valign="top">value</td>
|
---|
300 | <td valign="top">value of the property.</td>
|
---|
301 | <td align="center" valign="top">Yes</td>
|
---|
302 | </tr>
|
---|
303 | </table>
|
---|
304 | </blockquote>
|
---|
305 |
|
---|
306 | <h4>factory ('trax' processors only)</h4>
|
---|
307 | Used to specify factory settings.
|
---|
308 | <blockquote>
|
---|
309 | <h4>Parameters</h4>
|
---|
310 | <table width="60%" border="1" cellpadding="2" cellspacing="0">
|
---|
311 | <tr>
|
---|
312 | <td valign="top"><b>Attribute</b></td>
|
---|
313 | <td valign="top"><b>Description</b></td>
|
---|
314 | <td align="center" valign="top"><b>Required</b></td>
|
---|
315 | </tr>
|
---|
316 | <tr>
|
---|
317 | <td valign="top">name</td>
|
---|
318 | <td valign="top">fully qualified classname of the
|
---|
319 | transformer factory to use. For example
|
---|
320 | <tt>org.apache.xalan.processor.TransformerFactoryImpl</tt>
|
---|
321 | or <tt>org.apache.xalan.xsltc.trax.TransformerFactoryImpl</tt>
|
---|
322 | or <tt>net.sf.saxon.TransformerFactoryImpl</tt>...
|
---|
323 | </td>
|
---|
324 | <td align="center" valign="top">No. Defaults to the JAXP lookup mechanism.</td>
|
---|
325 | </tr>
|
---|
326 | </table>
|
---|
327 | <h3>Parameters specified as nested elements</h3>
|
---|
328 | <h4>attribute </h4>
|
---|
329 | <p>Used to specify settings of the processor factory.
|
---|
330 | The attribute names and values are entirely processor specific
|
---|
331 | so you must be aware of the implementation to figure them out.
|
---|
332 | Read the documentation of your processor.
|
---|
333 | For example, in Xalan 2.x:
|
---|
334 | <ul>
|
---|
335 | <li>http://xml.apache.org/xalan/features/optimize (boolean)</li>
|
---|
336 | <li>http://xml.apache.org/xalan/features/incremental (boolean)</li>
|
---|
337 | <li>...</li>
|
---|
338 | </ul>
|
---|
339 | And in Saxon 7.x:
|
---|
340 | <ul>
|
---|
341 | <li>http://saxon.sf.net/feature/allow-external-functions (boolean)</li>
|
---|
342 | <li>http://saxon.sf.net/feature/timing (boolean)</li>
|
---|
343 | <li>http://saxon.sf.net/feature/traceListener (string)</li>
|
---|
344 | <li>http://saxon.sf.net/feature/treeModel (integer)</li>
|
---|
345 | <li>http://saxon.sf.net/feature/linenumbering (integer)</li>
|
---|
346 | <li>...</li>
|
---|
347 | </ul>
|
---|
348 | <blockquote>
|
---|
349 | <h4>Parameters</h4>
|
---|
350 | <table width="60%" border="1" cellpadding="2" cellspacing="0">
|
---|
351 | <tr>
|
---|
352 | <td valign="top"><b>Attribute</b></td>
|
---|
353 | <td valign="top"><b>Description</b></td>
|
---|
354 | <td align="center" valign="top"><b>Required</b></td>
|
---|
355 | </tr>
|
---|
356 | <tr>
|
---|
357 | <td valign="top">name</td>
|
---|
358 | <td valign="top">Name of the attribute</td>
|
---|
359 | <td align="center" valign="top">Yes</td>
|
---|
360 | </tr>
|
---|
361 | <tr>
|
---|
362 | <td valign="top">value</td>
|
---|
363 | <td valign="top">value of the attribute.</td>
|
---|
364 | <td align="center" valign="top">Yes</td>
|
---|
365 | </tr>
|
---|
366 | </table>
|
---|
367 | </blockquote>
|
---|
368 | </blockquote>
|
---|
369 | <h4>mapper</h4>
|
---|
370 |
|
---|
371 | <p><em>since Ant 1.6.2</em></p>
|
---|
372 |
|
---|
373 | <p>You can define filename transformations by using a nested <a
|
---|
374 | href="../CoreTypes/mapper.html">mapper</a> element. The default mapper
|
---|
375 | used by <code><xslt></code> removes the file extension from the
|
---|
376 | source file and adds the extension specified via the extension
|
---|
377 | attribute.</p>
|
---|
378 |
|
---|
379 | <h4>style</h4>
|
---|
380 |
|
---|
381 | <p><em>Since Ant 1.7</em></p>
|
---|
382 |
|
---|
383 | <p>The nested style element can be used to specify your stylesheet in terms
|
---|
384 | of Ant's <a href="../CoreTypes/resources.html">resource</a> types. With
|
---|
385 | this element, the stylesheet should be specified as a nested resource or
|
---|
386 | single-element collection. Alternatively, use the <code>refid</code> to
|
---|
387 | specify the resource or collection as a reference.</p>
|
---|
388 |
|
---|
389 | <h3>Examples</h3>
|
---|
390 | <blockquote>
|
---|
391 | <pre>
|
---|
392 | <style basedir="doc" destdir="build/doc"
|
---|
393 | extension=".html" style="style/apache.xsl"/></pre>
|
---|
394 | <h4>Using an xmlcatalog</h4>
|
---|
395 | <pre>
|
---|
396 | <xslt basedir="doc" destdir="build/doc"
|
---|
397 | extension=".html" style="style/apache.xsl">
|
---|
398 | <xmlcatalog refid="mycatalog"/>
|
---|
399 | </xslt>
|
---|
400 |
|
---|
401 | <xslt basedir="doc" destdir="build/doc"
|
---|
402 | extension=".html" style="style/apache.xsl">
|
---|
403 | <xmlcatalog>
|
---|
404 | <dtd
|
---|
405 | publicId="-//ArielPartners//DTD XML Article V1.0//EN"
|
---|
406 | location="com/arielpartners/knowledgebase/dtd/article.dtd"/>
|
---|
407 | </xmlcatalog>
|
---|
408 | </xslt>
|
---|
409 | </pre>
|
---|
410 | <h4>Using XSL parameters</h4>
|
---|
411 | <pre>
|
---|
412 | <xslt basedir="doc" destdir="build/doc"
|
---|
413 | extension=".html" style="style/apache.xsl">
|
---|
414 | <param name="date" expression="07-01-2000"/>
|
---|
415 | </xslt></pre>
|
---|
416 |
|
---|
417 | <p>Then if you declare a global parameter "date" with the top-level
|
---|
418 | element <xsl:param name="date"/>, the variable
|
---|
419 | <code>$date</code> will subsequently have the value 07-01-2000.
|
---|
420 | </p>
|
---|
421 |
|
---|
422 | <h4>Using output properties</h4>
|
---|
423 | <pre>
|
---|
424 | <xslt in="doc.xml" out="build/doc/output.xml"
|
---|
425 | style="style/apache.xsl">
|
---|
426 | <outputproperty name="method" value="xml"/>
|
---|
427 | <outputproperty name="standalone" value="yes"/>
|
---|
428 | <outputproperty name="encoding" value="iso8859_1"/>
|
---|
429 | <outputproperty name="indent" value="yes"/>
|
---|
430 | </xslt>
|
---|
431 | </pre>
|
---|
432 |
|
---|
433 | <h4>Using factory settings</h4>
|
---|
434 | <pre>
|
---|
435 | <xslt in="doc.xml" out="build/doc/output.xml"
|
---|
436 | style="style/apache.xsl">
|
---|
437 | <factory name="org.apache.xalan.processor.TransformerFactoryImpl">
|
---|
438 | <attribute name="http://xml.apache.org/xalan/features/optimize" value="true"/>
|
---|
439 | </factory>
|
---|
440 | </xslt></pre>
|
---|
441 |
|
---|
442 | <h4>Using a mapper</h4>
|
---|
443 | <pre>
|
---|
444 | <xslt basedir="in" destdir="out"
|
---|
445 | style="style/apache.xsl">
|
---|
446 | <mapper type="glob" from="*.xml.en" to="*.html.en"/>
|
---|
447 | </xslt></pre>
|
---|
448 |
|
---|
449 | <h4>Using a nested resource to define the stylesheet</h4>
|
---|
450 | <pre>
|
---|
451 | <xslt in="data.xml" out="${out.dir}/out.xml">
|
---|
452 | <style>
|
---|
453 | <url url="${printParams.xsl.url}"/>
|
---|
454 | </style>
|
---|
455 | <param name="set" expression="value"/>
|
---|
456 | </xslt></pre>
|
---|
457 |
|
---|
458 | <h4>Print the current processed file name</h4>
|
---|
459 | <pre>
|
---|
460 | <project>
|
---|
461 | <xslt style="printFilename.xsl" destdir="out" basedir="in" extension=".txt"
|
---|
462 | filenameparameter="filename"
|
---|
463 | filedirparameter="filedir"
|
---|
464 | />
|
---|
465 | </project>
|
---|
466 |
|
---|
467 | <xsl:stylesheet
|
---|
468 | version="1.0"
|
---|
469 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
---|
470 |
|
---|
471 | <xsl:param name="filename"></xsl:param>
|
---|
472 | <xsl:param name="filedir">.</xsl:param>
|
---|
473 |
|
---|
474 | <xsl:template match="/">
|
---|
475 | Current file is <xsl:value-of select="$filename"/> in directory <xsl:value-of select="$filedir"/>.
|
---|
476 | </xsl:template>
|
---|
477 |
|
---|
478 | </xsl:stylesheet>
|
---|
479 | </pre>
|
---|
480 |
|
---|
481 | </blockquote>
|
---|
482 |
|
---|
483 |
|
---|
484 | </body>
|
---|
485 | </html>
|
---|