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.

common2master.xsl 2.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!--
  3. This stylesheet can be used to generate a master buildfile from a common
  4. buildfile (see manual for <subant>).
  5. Foreach <target> in the common buildfile it generates a corresponding
  6. target in the master buildfile for iterating over that target.
  7. -->
  8. <xsl:stylesheet
  9. version="1.0"
  10. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  11. <!--
  12. Licensed to the Apache Software Foundation (ASF) under one or more
  13. contributor license agreements. See the NOTICE file distributed with
  14. this work for additional information regarding copyright ownership.
  15. The ASF licenses this file to You under the Apache License, Version 2.0
  16. (the "License"); you may not use this file except in compliance with
  17. the License. You may obtain a copy of the License at
  18. http://www.apache.org/licenses/LICENSE-2.0
  19. Unless required by applicable law or agreed to in writing, software
  20. distributed under the License is distributed on an "AS IS" BASIS,
  21. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. See the License for the specific language governing permissions and
  23. limitations under the License.
  24. -->
  25. <xsl:output indent="no" method="text" encoding="ISO-8859-1"/>
  26. <xsl:strip-space elements="*"/>
  27. <xsl:template match="/">
  28. <xsl:apply-templates/>
  29. </xsl:template>
  30. <xsl:template match="project">
  31. <![CDATA[
  32. <project name="master">
  33. <macrodef name="iterate">
  34. <attribute name="target"/>
  35. <sequential>
  36. <subant target="@{target}">
  37. <fileset dir="modules" includes="*/build.xml"/>
  38. </subant>
  39. </sequential>
  40. </macrodef>
  41. ]]>
  42. <xsl:apply-templates/>
  43. <![CDATA[
  44. </project>
  45. ]]>
  46. </xsl:template>
  47. <xsl:template match="target">
  48. &lt;target name=&quot;<xsl:value-of select="@name"/>&quot;<xsl:if test="@description"> description=&quot;<xsl:value-of select="@description"/>&quot;</xsl:if>&gt;
  49. &lt;iterate target=&quot;<xsl:value-of select="@name"/>&quot;/&gt;
  50. &lt;/target&gt;
  51. </xsl:template>
  52. <xsl:template match="text()"/>
  53. </xsl:stylesheet>