You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

style.html 7.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant User Manual</title>
  5. </head>
  6. <body>
  7. <h2><a name="style">Style</a></h2>
  8. <h3>Description</h3>
  9. <p>Process a set of documents via XSLT.</p>
  10. <p>This is useful for building views of XML based documentation,
  11. or in generating code.</p>
  12. <p><b>Note:</b> This task depends on external libraries not included in the Ant distribution.
  13. See <a href="../install.html#librarydependencies">Library Dependencies</a> for more information.</p>
  14. <p>It is possible to refine the set of files that are being copied. This can be
  15. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  16. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  17. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  18. the files you want to have excluded. This is also done with patterns. And
  19. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  20. want to use default exclusions or not. See the section on <a
  21. href="../dirtasks.html#directorybasedtasks">directory based tasks</a>, on how the
  22. inclusion/exclusion of files works, and how to write patterns.</p>
  23. <p>This task forms an implicit <a href="../CoreTypes/fileset.html">FileSet</a> and supports all
  24. attributes of <code>&lt;fileset&gt;</code> (<code>dir</code> becomes <code>basedir</code>)
  25. as well as the nested <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code>
  26. and <code>&lt;patternset&gt;</code> elements.</p>
  27. <p>Style supports the use of a &lt;param&gt; element which is used to pass values
  28. to an &lt;xsl:param&gt; declaration.</p>
  29. <p>If you want to use Xalan-J 1 or XSL:P, you also need Ant's optional.jar</p>
  30. <h3>Parameters</h3>
  31. <table border="1" cellpadding="2" cellspacing="0">
  32. <tr>
  33. <td valign="top"><b>Attribute</b></td>
  34. <td valign="top"><b>Description</b></td>
  35. <td align="center" valign="top"><b>Required</b></td>
  36. </tr>
  37. <tr>
  38. <td valign="top">basedir</td>
  39. <td valign="top">where to find the source XML file, default is the
  40. project's basedir.</td>
  41. <td align="center" valign="top">No</td>
  42. </tr>
  43. <tr>
  44. <td valign="top">destdir</td>
  45. <td valign="top">directory in which to store the results.</td>
  46. <td align="center" valign="top">Yes, unless in and out have been
  47. specified.</td>
  48. </tr>
  49. <tr>
  50. <td valign="top">extension</td>
  51. <td valign="top">desired file extension to be used for the targets. If not
  52. specified, the default is &quot;html&quot;.</td>
  53. <td align="center" valign="top">No</td>
  54. </tr>
  55. <tr>
  56. <td valign="top">style</td>
  57. <td valign="top">name of the stylesheet to use - given either relative
  58. to the project's basedir or as an absolute path
  59. <em><strong>DEPRECATED</strong> - can be specified as a path relative
  60. to the basedir attribute of this task as well</em>.
  61. </td>
  62. <td align="center" valign="top">Yes</td>
  63. </tr>
  64. <tr>
  65. <td valign="top">classpath</td>
  66. <td valign="top">the classpath to use when looking up the XSLT
  67. processor.</td>
  68. <td align="center" valign="top">No</td>
  69. </tr>
  70. <tr>
  71. <td valign="top">classpathref</td>
  72. <td valign="top">the classpath to use, given as <a
  73. href="../using.html#references">reference</a> to a path defined elsewhere.</td>
  74. <td align="center" valign="top">No</td>
  75. </tr>
  76. <tr>
  77. <td valign="top">force</td>
  78. <td valign="top">Recreate target files, even if they are newer
  79. than their corresponding source files or the stylesheet.</td>
  80. <td valign="top" align="center">No</td>
  81. </tr>
  82. <tr>
  83. <td valign="top">processor</td>
  84. <td valign="top">name of the XSLT processor to use. Permissible values are
  85. &quot;trax&quot; for a TraX compliant processor, &quot;xslp&quot; for the
  86. XSL:P processor, &quot;xalan&quot; for the Apache XML Xalan (version 1)
  87. processor, or the name of an arbitrary XSLTLiaison class. Defaults to trax,
  88. followed by xslp then xalan (in that order). The first one found in your
  89. class path is the one that is used.
  90. <em><strong>DEPRECATED</strong> - XSL:P is deprecated and will be removed
  91. in the next version. Use trax or xalan instead.</em>.
  92. </td>
  93. <td align="center" valign="top">No</td>
  94. </tr>
  95. <tr>
  96. <td valign="top">includes</td>
  97. <td valign="top">comma separated list of patterns of files that must be included.
  98. All files are included when omitted.</td>
  99. <td valign="top" align="center">No</td>
  100. </tr>
  101. <tr>
  102. <td valign="top">includesfile</td>
  103. <td valign="top">the name of a file. Each line of this file is taken to be
  104. an include pattern</td>
  105. <td valign="top" align="center">No</td>
  106. </tr>
  107. <tr>
  108. <td valign="top">excludes</td>
  109. <td valign="top">comma separated list of patterns of files that must be excluded.
  110. No files (except default excludes) are excluded when omitted.</td>
  111. <td valign="top" align="center">No</td>
  112. </tr>
  113. <tr>
  114. <td valign="top">excludesfile</td>
  115. <td valign="top">the name of a file. Each line of this file is taken to be
  116. an exclude pattern</td>
  117. <td valign="top" align="center">No</td>
  118. </tr>
  119. <tr>
  120. <td valign="top">defaultexcludes</td>
  121. <td valign="top">indicates whether default excludes should be used or not
  122. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  123. <td valign="top" align="center">No</td>
  124. </tr>
  125. <tr>
  126. <td valign="top">in</td>
  127. <td valign="top">specifies a single XML document to be styled. Should be used
  128. with the out attribute.</td>
  129. <td valign="top" align="center">No</td>
  130. </tr>
  131. <tr>
  132. <td valign="top">out</td>
  133. <td valign="top">specifies the output name for the styled result from the
  134. in attribute.</td>
  135. <td valign="top" align="center">No</td>
  136. </tr>
  137. </table>
  138. <h3>Parameters specified as nested elements</h3>
  139. <h4>classpath</h4>
  140. <p>The classpath to load the processor from can be specified via a
  141. nested <code>&lt;classpath&gt;</code>, as well - that is, a
  142. <a href="../using.html#path">path</a>-like structure.</p>
  143. <h4>param</h4>
  144. <p>Param is used to pass a parameter to the XSL stylesheet.</p>
  145. <h4>Parameters</h4>
  146. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  147. <tr>
  148. <td valign="top"><b>Attribute</b></td>
  149. <td valign="top"><b>Description</b></td>
  150. <td align="center" valign="top"><b>Required</b></td>
  151. </tr>
  152. <tr>
  153. <td valign="top">name</td>
  154. <td valign="top">Name of the XSL parameter</td>
  155. <td align="center" valign="top">Yes</td>
  156. </tr>
  157. <tr>
  158. <td valign="top">expression</td>
  159. <td valign="top">XSL expression to be placed into the param. To pass a text
  160. value into the style sheet it needs to be escaped using single quotes.</td>
  161. <td align="center" valign="top">Yes</td>
  162. </tr>
  163. </table>
  164. <h3>Examples</h3>
  165. <blockquote>
  166. <pre>
  167. &lt;style basedir=&quot;doc&quot; destdir=&quot;build/doc&quot;
  168. extension=&quot;html&quot; style=&quot;style/apache.xsl&quot;/&gt;</pre>
  169. <h4>Using XSL parameters</h4>
  170. <pre>&lt;style basedir=&quot;doc&quot; destdir=&quot;build/doc&quot;
  171. extension=&quot;html&quot; style=&quot;style/apache.xsl&quot;&gt;
  172. &lt;param name=&quot;date&quot; expression=&quot;'07-01-2000'&quot;/&gt;
  173. &lt;/style&gt;</pre>
  174. <p>This will replace an xsl:param definition&lt;xsl:param name=&quot;date&quot;&gt;&lt;/xsl:param&gt;
  175. with the text value 07-01-2000 </p>
  176. </blockquote>
  177. <hr>
  178. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  179. Reserved.</p>
  180. </body>
  181. </html>