]> source.dussan.org Git - archiva.git/blob
eb22435fb31104226652fe69f2d068694265d3c3
[archiva.git] /
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3   ~ Licensed to the Apache Software Foundation (ASF) under one
4   ~ or more contributor license agreements.  See the NOTICE file
5   ~ distributed with this work for additional information
6   ~ regarding copyright ownership.  The ASF licenses this file
7   ~ to you under the Apache License, Version 2.0 (the
8   ~ "License"); you may not use this file except in compliance
9   ~ with the License.  You may obtain a copy of the License at
10   ~
11   ~   http://www.apache.org/licenses/LICENSE-2.0
12   ~
13   ~ Unless required by applicable law or agreed to in writing,
14   ~ software distributed under the License is distributed on an
15   ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   ~ KIND, either express or implied.  See the License for the
17   ~ specific language governing permissions and limitations
18   ~ under the License.
19   -->
20
21 <xsl:stylesheet
22     version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
23     xmlns:plexus="org.apache.maven.archiva.common.spring.CamelCaseXpathFunction">
24 <!--
25     use xalan extension mecanism to call static methods
26     @see http://www.ibm.com/developerworks/library/x-xalanextensions.html
27  -->
28
29 <xsl:output method="xml" indent="yes"
30     doctype-public="-//SPRING//DTD BEAN 2.0//EN"
31     doctype-system="http://www.springframework.org/dtd/spring-beans-2.0.dtd" />
32
33 <xsl:template match="/component-set">
34 <beans>
35   <xsl:for-each select="components/component">
36     <bean>
37       <xsl:choose>
38         <xsl:when test="role-hint">
39           <xsl:attribute name="id">
40             <xsl:value-of select="concat( role, '#', role-hint )" />
41           </xsl:attribute>
42         </xsl:when>
43         <xsl:otherwise>
44           <xsl:attribute name="id">
45             <xsl:value-of select="role" />
46           </xsl:attribute>
47         </xsl:otherwise>
48       </xsl:choose>
49       <xsl:attribute name="class">
50         <xsl:value-of select="implementation" />
51       </xsl:attribute>
52         <xsl:if test="instanciation-strategy/text() = 'per-lookup'">
53           <xsl:attribute name="scope">prototype</xsl:attribute>
54         </xsl:if>
55       <xsl:for-each select="requirements/requirement">
56         <property>
57           <xsl:attribute name="name">
58             <xsl:value-of select="field-name" />
59           </xsl:attribute>
60           <xsl:choose>
61             <xsl:when test="role-hint">
62               <xsl:attribute name="ref">
63                 <xsl:value-of select="concat( role, '#', role-hint )" />
64               </xsl:attribute>
65             </xsl:when>
66             <xsl:otherwise>
67               <xsl:attribute name="ref">
68                 <xsl:value-of select="role" />
69               </xsl:attribute>
70             </xsl:otherwise>
71           </xsl:choose>
72         </property>
73       </xsl:for-each>
74       <xsl:for-each select="configuration/*">
75         <property>
76           <xsl:attribute name="name">
77             <xsl:value-of select="plexus:toCamelCase( name(.) )" />
78           </xsl:attribute>
79           <xsl:attribute name="value">
80             <xsl:value-of select="." />
81           </xsl:attribute>
82         </property>
83       </xsl:for-each>
84     </bean>
85   </xsl:for-each>
86 </beans>
87 </xsl:template>
88
89 </xsl:stylesheet>