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.

bootstrap.xsl 6.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  2. <xsl:strip-space elements="*"/>
  3. <xsl:output method="text" omit-xml-declaration="yes"/>
  4. <xsl:template match="project">
  5. <xsl:text>package org.apache.ant.builder;&#10;</xsl:text>
  6. <xsl:text>public class </xsl:text>
  7. <xsl:value-of select="attribute::name"/>
  8. <xsl:text>Builder {&#10;</xsl:text>
  9. <xsl:text> protected void _init(BuildHelper helper) {&#10;</xsl:text>
  10. <xsl:apply-templates select="property"/>
  11. <xsl:apply-templates select="path"/>
  12. <xsl:text> }&#10;</xsl:text>
  13. <xsl:apply-templates select="target"/>
  14. <xsl:text>}&#10;</xsl:text>
  15. </xsl:template>
  16. <xsl:template match="property">
  17. <xsl:text> helper.setProperty(&quot;</xsl:text>
  18. <xsl:value-of select="attribute::name"/>
  19. <xsl:text>&quot;, &quot;</xsl:text>
  20. <xsl:value-of select="attribute::value"/>
  21. <xsl:text>&quot;);&#10;</xsl:text>
  22. </xsl:template>
  23. <xsl:template match="echo">
  24. </xsl:template>
  25. <xsl:template match="path">
  26. <xsl:text> helper.createPath(&quot;</xsl:text>
  27. <xsl:variable name="pathName" select="attribute::id"/>
  28. <xsl:value-of select="$pathName"/>
  29. <xsl:text>&quot;);&#10;</xsl:text>
  30. <xsl:for-each select="fileset">
  31. <xsl:text> </xsl:text>
  32. <xsl:text>helper.addFileSetToPath(&quot;</xsl:text>
  33. <xsl:value-of select="$pathName"/>
  34. <xsl:text>&quot;, &#10;</xsl:text>
  35. <xsl:text> &quot;</xsl:text>
  36. <xsl:value-of select="attribute::dir"/>
  37. <xsl:text>&quot;, </xsl:text>
  38. <xsl:choose>
  39. <xsl:when test="attribute::includes">
  40. <xsl:text>&quot;</xsl:text>
  41. <xsl:value-of select="attribute::includes"/>
  42. <xsl:text>&quot;</xsl:text>
  43. </xsl:when>
  44. <xsl:otherwise>
  45. <xsl:text>null</xsl:text>
  46. </xsl:otherwise>
  47. </xsl:choose>
  48. <xsl:text>);&#10;</xsl:text>
  49. </xsl:for-each>
  50. <xsl:for-each select="pathelement">
  51. <xsl:text> </xsl:text>
  52. <xsl:text>helper.addPathElementToPath(&quot;</xsl:text>
  53. <xsl:value-of select="$pathName"/>
  54. <xsl:text>&quot;, &quot;</xsl:text>
  55. <xsl:value-of select="attribute::location"/>
  56. <xsl:text>&quot;);&#10;</xsl:text>
  57. </xsl:for-each>
  58. <xsl:for-each select="path">
  59. <xsl:text> </xsl:text>
  60. <xsl:text>helper.addPathToPath(&quot;</xsl:text>
  61. <xsl:value-of select="$pathName"/>
  62. <xsl:text>&quot;, &quot;</xsl:text>
  63. <xsl:value-of select="attribute::refid"/>
  64. <xsl:text>&quot;);&#10;</xsl:text>
  65. </xsl:for-each>
  66. </xsl:template>
  67. <xsl:template match="target">
  68. <xsl:text> protected void </xsl:text>
  69. <xsl:value-of select="translate(attribute::name, '-', '_')"/>
  70. <xsl:text>(BuildHelper helper) {&#10;</xsl:text>
  71. <xsl:apply-templates/>
  72. <xsl:text> }&#10;</xsl:text>
  73. </xsl:template>
  74. <xsl:template match="mkdir">
  75. <xsl:text> helper.mkdir(&quot;</xsl:text>
  76. <xsl:value-of select="attribute::dir"/>
  77. <xsl:text>&quot;);&#10;</xsl:text>
  78. </xsl:template>
  79. <xsl:template match="javac">
  80. <xsl:text> helper.javac(&quot;</xsl:text>
  81. <xsl:value-of select="attribute::srcdir"/>
  82. <xsl:text>&quot;, &quot;</xsl:text>
  83. <xsl:value-of select="attribute::destdir"/>
  84. <xsl:text>&quot;, </xsl:text>
  85. <xsl:choose>
  86. <xsl:when test="classpath">
  87. <xsl:text>&quot;</xsl:text>
  88. <xsl:value-of select="classpath/attribute::refid"/>
  89. <xsl:text>&quot;</xsl:text>
  90. </xsl:when>
  91. <xsl:otherwise>
  92. <xsl:text>null</xsl:text>
  93. </xsl:otherwise>
  94. </xsl:choose>
  95. <xsl:text>);&#10;</xsl:text>
  96. </xsl:template>
  97. <xsl:template match="jar">
  98. <xsl:text> helper.jar(&quot;</xsl:text>
  99. <xsl:value-of select="attribute::basedir"/>
  100. <xsl:text>&quot;, &quot;</xsl:text>
  101. <xsl:value-of select="attribute::jarfile"/>
  102. <xsl:text>&quot;,&#10; </xsl:text>
  103. <xsl:choose>
  104. <xsl:when test="metainf">
  105. <xsl:text>&quot;</xsl:text>
  106. <xsl:value-of select="metainf/attribute::dir"/>
  107. <xsl:text>&quot;, </xsl:text>
  108. <xsl:choose>
  109. <xsl:when test="metainf/attribute::includes">
  110. <xsl:text>&quot;</xsl:text>
  111. <xsl:value-of select="metainf/attribute::includes"/>
  112. <xsl:text>&quot;, </xsl:text>
  113. </xsl:when>
  114. <xsl:otherwise>
  115. <xsl:text>null, </xsl:text>
  116. </xsl:otherwise>
  117. </xsl:choose>
  118. </xsl:when>
  119. <xsl:otherwise>
  120. <xsl:text>null, null, </xsl:text>
  121. </xsl:otherwise>
  122. </xsl:choose>
  123. <xsl:choose>
  124. <xsl:when test="manifest/attribute[attribute::name='Class-Path']">
  125. <xsl:text>&quot;</xsl:text>
  126. <xsl:value-of select="manifest/attribute[attribute::name='Class-Path']/attribute::value"/>
  127. <xsl:text>&quot;, </xsl:text>
  128. </xsl:when>
  129. <xsl:otherwise>null, </xsl:otherwise>
  130. </xsl:choose>
  131. <xsl:choose>
  132. <xsl:when test="manifest/attribute[attribute::name='Main-Class']">
  133. <xsl:text>&quot;</xsl:text>
  134. <xsl:value-of select="manifest/attribute[attribute::name='Main-Class']/attribute::value"/>
  135. <xsl:text>&quot;</xsl:text>
  136. </xsl:when>
  137. <xsl:otherwise>null</xsl:otherwise>
  138. </xsl:choose>
  139. <xsl:text>);&#10;</xsl:text>
  140. </xsl:template>
  141. <xsl:template match="copy/fileset">
  142. <xsl:choose>
  143. <xsl:when test="attribute::refid">
  144. <xsl:text> helper.copyFilesetRef(&quot;</xsl:text>
  145. <xsl:value-of select="attribute::refid"/>
  146. <xsl:text>&quot;, &quot;</xsl:text>
  147. <xsl:value-of select="../attribute::todir"/>
  148. <xsl:text>&quot;);&#10;</xsl:text>
  149. </xsl:when>
  150. <xsl:otherwise>
  151. <xsl:text> helper.copyFileset(&quot;</xsl:text>
  152. <xsl:value-of select="attribute::dir"/>
  153. <xsl:text>&quot;, &quot;</xsl:text>
  154. <xsl:value-of select="../attribute::todir"/>
  155. <xsl:text>&quot;);&#10;</xsl:text>
  156. </xsl:otherwise>
  157. </xsl:choose>
  158. </xsl:template>
  159. </xsl:stylesheet>