]> source.dussan.org Git - archiva.git/blob
d766a0f47b9b9233ba7e6487ac8de9854515e1e2
[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"/>\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 <beans xmlns="http://www.springframework.org/schema/beans"\r
34        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
35        xmlns:plexus="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   <xsl:for-each select="components/component">\r
39 \r
40     <plexus:component>\r
41       <xsl:attribute name="role">\r
42         <xsl:value-of select="role" />\r
43       </xsl:attribute>\r
44       <xsl:if test="role-hint">\r
45         <xsl:attribute name="role-hint">\r
46           <xsl:value-of select="role-hint" />\r
47         </xsl:attribute>\r
48       </xsl:if>\r
49       <xsl:attribute name="implementation">\r
50         <xsl:value-of select="implementation" />\r
51       </xsl:attribute>\r
52       <xsl:if test="instantiation-strategy">\r
53         <xsl:attribute name="instantiation-strategy">\r
54           <xsl:value-of select="instantiation-strategy" />\r
55         </xsl:attribute>\r
56       </xsl:if>\r
57       <xsl:for-each select="requirements/requirement">\r
58         <plexus:requirement>\r
59           <xsl:attribute name="name">\r
60             <xsl:value-of select="field-name" />\r
61           </xsl:attribute>\r
62           <xsl:attribute name="role">\r
63             <xsl:value-of select="role" />\r
64           </xsl:attribute>\r
65           <xsl:if test="role-hint">\r
66             <xsl:attribute name="role-hint">\r
67               <xsl:value-of select="role-hint" />\r
68             </xsl:attribute>\r
69           </xsl:if>\r
70         </plexus:requirement>\r
71       </xsl:for-each>\r
72       <xsl:for-each select="configuration/*">\r
73         <plexus:configuration>\r
74           <xsl:attribute name="name">\r
75             <xsl:value-of select="name(.)" />\r
76           </xsl:attribute>\r
77           <xsl:attribute name="value">\r
78             <xsl:value-of select="." />\r
79           </xsl:attribute>\r
80         </plexus:configuration>\r
81       </xsl:for-each>\r
82     </plexus:component>\r
83 \r
84   </xsl:for-each>\r
85 </beans>\r
86 </xsl:template>\r
87 \r
88 </xsl:stylesheet>