]> source.dussan.org Git - archiva.git/blob
9b64e187f60c29ab4916f255fa39916361072aad
[archiva.git] /
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!--\r
3   ~ Licensed to the Apache Software Foundation (ASF) under one\r
4   ~ or more contributor license agreements.  See the NOTICE file\r
5   ~ distributed with this work for additional information\r
6   ~ regarding copyright ownership.  The ASF licenses this file\r
7   ~ to you under the Apache License, Version 2.0 (the\r
8   ~ "License"); you may not use this file except in compliance\r
9   ~ with the License.  You may obtain a copy of the License at\r
10   ~\r
11   ~   http://www.apache.org/licenses/LICENSE-2.0\r
12   ~\r
13   ~ Unless required by applicable law or agreed to in writing,\r
14   ~ software distributed under the License is distributed on an\r
15   ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
16   ~ KIND, either express or implied.  See the License for the\r
17   ~ specific language governing permissions and limitations\r
18   ~ under the License.\r
19   -->\r
20 \r
21 <xsl:stylesheet\r
22     version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
23     xmlns:plexus="http://plexus.codehaus.org/spring">\r
24 \r
25 <xsl:output method="xml" cdata-section-elements="configuration"/>\r
26 \r
27 <!--\r
28   Convert a plexus descriptor to a spring XML context with help of the custom <plexus: namespace\r
29   to handle IoC containers incompatibilities.\r
30  -->\r
31 \r
32 <xsl:template match="/component-set" >\r
33 <spring:beans xmlns:spring="http://www.springframework.org/schema/beans"\r
34        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
35        xmlns="http://plexus.codehaus.org/spring"\r
36        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
37                            http://plexus.codehaus.org/spring http://plexus.codehaus.org/schemas/spring-1.0.xsd"\r
38        default-lazy-init="true">\r
39   <xsl:for-each select="components/component">\r
40 \r
41     <component>\r
42       <xsl:attribute name="role">\r
43         <xsl:value-of select="role" />\r
44       </xsl:attribute>\r
45       <xsl:if test="role-hint">\r
46         <xsl:attribute name="role-hint">\r
47           <xsl:value-of select="role-hint" />\r
48         </xsl:attribute>\r
49       </xsl:if>\r
50       <xsl:attribute name="implementation">\r
51         <xsl:value-of select="implementation" />\r
52       </xsl:attribute>\r
53       <xsl:if test="instantiation-strategy">\r
54         <xsl:attribute name="instantiation-strategy">\r
55           <xsl:value-of select="instantiation-strategy" />\r
56         </xsl:attribute>\r
57       </xsl:if>\r
58       <xsl:for-each select="requirements/requirement">\r
59         <requirement>\r
60           <xsl:attribute name="field-name">\r
61             <xsl:value-of select="field-name" />\r
62           </xsl:attribute>\r
63           <xsl:attribute name="role">\r
64             <xsl:value-of select="role" />\r
65           </xsl:attribute>\r
66           <xsl:if test="role-hint">\r
67             <xsl:attribute name="role-hint">\r
68               <xsl:value-of select="role-hint" />\r
69             </xsl:attribute>\r
70           </xsl:if>\r
71         </requirement>\r
72       </xsl:for-each>\r
73       <xsl:for-each select="configuration/*">\r
74         <configuration>\r
75           <xsl:attribute name="name">\r
76             <xsl:value-of select="name(.)" />\r
77           </xsl:attribute>\r
78           <xsl:copy-of select="child::node()" />\r
79         </configuration>\r
80       </xsl:for-each>\r
81     </component>\r
82 \r
83   </xsl:for-each>\r
84 </spring:beans>\r
85 </xsl:template>\r
86 \r
87 </xsl:stylesheet>