4e40f68fbe97c8c1ff9b401069fe56e917622ade
[shibboleth/sp.git] / configs / upgrade.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
3     xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
4     xmlns:oldconf="urn:mace:shibboleth:target:config:1.0"
5     xmlns:cred="urn:mace:shibboleth:credentials:1.0"
6     xmlns:conf="urn:mace:shibboleth:2.0:native:sp:config"
7     xmlns="urn:mace:shibboleth:2.0:native:sp:config"
8     xmlns:saml1="urn:oasis:names:tc:SAML:1.0:assertion"
9     xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
10     xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
11     exclude-result-prefixes="oldconf cred saml1">
12
13     <xsl:param name="idp"/>
14     
15     <!--Force UTF-8 encoding for the output.-->
16     <xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8"/>
17
18     <xsl:variable name="spaces" select="string('                                                                                          ')"/>
19
20     <xsl:template match="/">
21         <xsl:apply-templates/>
22     </xsl:template>
23     
24     <xsl:template match="oldconf:SPConfig">
25         <xsl:text>&#10;</xsl:text>
26         <SPConfig logger="{@logger}" clockSkew="{@clockSkew}">
27             <xsl:text>&#10;</xsl:text>
28             <xsl:comment>
29                 <xsl:text> Generated by upgrade utility: check carefully before deploying. </xsl:text>
30             </xsl:comment>
31             <xsl:text>&#10;&#10;</xsl:text>
32             <xsl:apply-templates select="oldconf:Global"/>
33             <xsl:text>&#10;</xsl:text>
34             <xsl:apply-templates select="oldconf:Local"/>
35             <xsl:text>&#10;</xsl:text>
36             <xsl:apply-templates select="oldconf:Global/oldconf:UnixListener"/>
37             <xsl:apply-templates select="oldconf:Global/oldconf:TCPListener"/>
38             <xsl:text>&#10;    </xsl:text>
39             <xsl:comment>
40                 <xsl:text> This set of components stores sessions and other persistent data in daemon memory. </xsl:text>
41             </xsl:comment>
42             <xsl:text>&#10;    </xsl:text>
43             <StorageService type="Memory" id="mem" cleanupInterval="900"/>
44             <xsl:text>&#10;    </xsl:text>
45             <SessionCache type="StorageService" StorageService="mem" cacheTimeout="{oldconf:Global/oldconf:MemorySessionCache/@cacheTimeout}" inprocTimeout="900" cleanupInterval="900"/>
46             <xsl:text>&#10;    </xsl:text>
47             <ReplayCache StorageService="mem"/>
48             <xsl:text>&#10;    </xsl:text>
49             <ArtifactMap artifactTTL="180"/>
50             <xsl:text>&#10;&#10;    </xsl:text>
51             <xsl:comment>
52                 <xsl:text> This set of components stores sessions and other persistent data in an ODBC database. </xsl:text>
53             </xsl:comment>
54             <xsl:text>&#10;    </xsl:text>
55             <xsl:comment>
56                 <xsl:text>
57     &lt;StorageService type="ODBC" id="db" cleanupInterval="900"&gt;
58         &lt;ConnectionString&gt;DRIVER=drivername;SERVER=dbserver;UID=shibboleth;PWD=password;DATABASE=shibboleth;APP=Shibboleth&lt;/ConnectionString&gt;
59     &lt;/StorageService&gt;
60     &lt;SessionCache type="StorageService" StorageService="db" cacheTimeout="3600" inprocTimeout="900" cleanupInterval="900"/&gt;
61     &lt;ReplayCache StorageService="db"/&gt;
62     &lt;ArtifactMap StorageService="db" artifactTTL="180"/&gt;
63     </xsl:text>
64             </xsl:comment>
65             <xsl:apply-templates select="oldconf:Local/oldconf:RequestMapProvider"/>
66             <xsl:apply-templates select="oldconf:Applications"/>
67
68             <xsl:text>&#10;&#10;    </xsl:text>
69             <xsl:comment>
70                 <xsl:text> Each policy defines a set of rules to use to secure messages. </xsl:text>
71             </xsl:comment>
72             <xsl:text>&#10;    </xsl:text>
73             <SecurityPolicies>
74                 <xsl:text>&#10;        </xsl:text>
75                 <xsl:comment>
76                     <xsl:text> The predefined policy enforces replay/freshness and permits signing and client TLS. </xsl:text>
77                 </xsl:comment>
78                 <xsl:text>&#10;        </xsl:text>
79                 <Policy id="default" validate="false">
80                     <xsl:text>&#10;            </xsl:text>
81                     <Rule type="MessageFlow" checkReplay="true" expires="60"/>
82                     <xsl:text>&#10;            </xsl:text>
83                     <Rule type="ClientCertAuth" errorFatal="true"/>
84                     <xsl:text>&#10;            </xsl:text>
85                     <Rule type="XMLSigning" errorFatal="true"/>
86                     <xsl:text>&#10;            </xsl:text>
87                     <Rule type="SimpleSigning" errorFatal="true"/>
88                     <xsl:text>&#10;        </xsl:text>
89                 </Policy>
90                 <xsl:text>&#10;    </xsl:text>
91             </SecurityPolicies>
92             <xsl:text>&#10;&#10;</xsl:text>
93         </SPConfig>
94     </xsl:template>
95     
96     <!-- Turn <Global> into <OutOfProcess> with the ODBC extension commented out. -->
97     <xsl:template match="oldconf:Global">
98         <xsl:text>&#10;    </xsl:text>
99         <OutOfProcess logger="{@logger}">
100             <xsl:text>&#10;        </xsl:text>
101             <xsl:comment>
102                 <xsl:text>
103         &lt;Extensions&gt;
104            &lt;Library path="odbc-store.so" fatal="true"/&gt;
105         &lt;/Extensions&gt;
106         </xsl:text>
107             </xsl:comment>
108             <xsl:text>&#10;    </xsl:text>
109         </OutOfProcess>
110         <xsl:text>&#10;</xsl:text>
111     </xsl:template>
112
113     <!-- Turn <Local> into <InProcess> with the <ISAPI> element up a level. -->
114     <xsl:template match="oldconf:Local">
115         <xsl:text>&#10;    </xsl:text>
116         <InProcess logger="{@logger}">
117             <xsl:if test="@unsetHeaderValue">
118                 <xsl:attribute name="unsetHeaderValue"><xsl:value-of select="@unsetHeaderValue"/></xsl:attribute>
119             </xsl:if>
120             <xsl:apply-templates select="oldconf:Implementation/oldconf:ISAPI"/>
121             <xsl:text>&#10;    </xsl:text>
122         </InProcess>
123         <xsl:text>&#10;</xsl:text>
124     </xsl:template>
125     <xsl:template match="oldconf:ISAPI">
126         <xsl:text>&#10;        </xsl:text>
127         <ISAPI>
128             <xsl:apply-templates select="@*"/>
129             <xsl:for-each select="oldconf:Site">
130                 <xsl:text>&#10;            </xsl:text>
131                 <Site>
132                     <xsl:apply-templates select="@*"/>
133                     <xsl:for-each select="oldconf:Alias">
134                         <xsl:text>&#10;                </xsl:text>
135                         <Alias><xsl:value-of select="text()"/></Alias>
136                     </xsl:for-each>
137                     <xsl:text>&#10;            </xsl:text>
138                 </Site>
139             </xsl:for-each>
140             <xsl:text>&#10;        </xsl:text>
141         </ISAPI>
142     </xsl:template>
143
144     <!-- Pull in listeners up to the top level. -->
145     <xsl:template match="oldconf:UnixListener">
146         <xsl:text>&#10;    </xsl:text>
147         <UnixListener address="shibd.sock"/>
148         <xsl:text>&#10;</xsl:text>
149     </xsl:template>
150     <xsl:template match="oldconf:TCPListener">
151         <xsl:text>&#10;    </xsl:text>
152         <TCPListener address="{@address}" port="{@port}" acl="{@acl}"/>
153         <xsl:text>&#10;</xsl:text>
154     </xsl:template>
155
156     <!-- Transplant old RequestMap into the new namespace, but just copy all the settings. -->
157     <xsl:template match="oldconf:RequestMapProvider">
158         <xsl:text>&#10;&#10;    </xsl:text>
159         <RequestMapper type="Native">
160             <xsl:text>&#10;</xsl:text>
161             <xsl:apply-templates select="./*">
162                 <xsl:with-param name="indent">8</xsl:with-param>
163             </xsl:apply-templates>
164             <xsl:text>    </xsl:text>
165         </RequestMapper>
166         <xsl:text>&#10;</xsl:text>
167     </xsl:template>
168
169     <xsl:template match="oldconf:Applications">
170         <xsl:text>&#10;    </xsl:text>
171         <ApplicationDefaults id="{@id}" policyId="default" entityID="{@providerId}" homeURL="{@homeURL}" REMOTE_USER="eppn persistent-id targeted-id" signing="false" encryption="false">
172             <xsl:attribute name="timeout"><xsl:value-of select="../oldconf:Global/oldconf:MemorySessionCache/@AATimeout"/></xsl:attribute>
173             <xsl:attribute name="connectTimeout"><xsl:value-of select="../oldconf:Global/oldconf:MemorySessionCache/@AAConnectTimeout"/></xsl:attribute>
174             <xsl:if test="oldconf:CredentialUse/@TLS!=../oldconf:CredentialsProvider/cred:Credentials/cred:FileResolver[1]/@Id">
175                 <xsl:attribute name="keyName"><xsl:value-of select="oldconf:CredentialUse/@TLS"/></xsl:attribute>
176             </xsl:if>
177             <xsl:if test="oldconf:CredentialUse/@signedAssertions">
178                 <xsl:attribute name="requireSignedAssertions"><xsl:value-of select="oldconf:CredentialUse/@signedAssertions"/></xsl:attribute>   
179             </xsl:if>
180             <xsl:text>&#10;</xsl:text>
181             <xsl:apply-templates select="oldconf:Sessions"/>
182             <xsl:apply-templates select="oldconf:Errors"/>
183             <xsl:apply-templates select="oldconf:CredentialUse"/>
184             <xsl:text>&#10;&#10;        </xsl:text>
185             <MetadataProvider type="Chaining">
186                 <xsl:for-each select="oldconf:MetadataProvider|oldconf:FederationProvider">
187                     <xsl:text>&#10;            </xsl:text>
188                     <MetadataProvider type="XML" file="{@uri}"/>
189                 </xsl:for-each>
190                 <xsl:text>&#10;        </xsl:text>
191             </MetadataProvider>
192             <xsl:text>&#10;&#10;        </xsl:text>
193             <xsl:comment>
194                 <xsl:text> Chain the two built-in trust engines together. </xsl:text>
195             </xsl:comment>
196             <xsl:text>&#10;        </xsl:text>
197             <TrustEngine type="Chaining">
198                 <xsl:text>&#10;            </xsl:text>
199                 <TrustEngine type="ExplicitKey"/>
200                 <xsl:text>&#10;            </xsl:text>
201                 <TrustEngine type="PKIX"/>
202                 <xsl:text>&#10;        </xsl:text>
203             </TrustEngine>
204             <xsl:text>&#10;&#10;        </xsl:text>
205             <xsl:comment>
206                 <xsl:text> Map to extract attributes from SAML assertions. </xsl:text>
207             </xsl:comment>
208             <xsl:text>&#10;        </xsl:text>
209             <AttributeExtractor type="XML" path="attribute-map.xml"/>
210             <xsl:text>&#10;&#10;        </xsl:text>
211             <xsl:comment>
212                 <xsl:text> Use a SAML query if no attributes are supplied during SSO. </xsl:text>
213             </xsl:comment>
214             <xsl:text>&#10;        </xsl:text>
215             <AttributeResolver type="Query"/>
216             <xsl:text>&#10;&#10;        </xsl:text>
217             <xsl:comment>
218                 <xsl:text> Default filtering policy for recognized attributes, lets other data pass. </xsl:text>
219             </xsl:comment>
220             <xsl:text>&#10;        </xsl:text>
221             <AttributeFilter type="XML" path="attribute-policy.xml"/>
222             <xsl:text>&#10;&#10;</xsl:text>
223        
224             <!-- Step up and pull in credentials from the top level. -->
225             <xsl:apply-templates select="../oldconf:CredentialsProvider"/>
226        
227             <xsl:for-each select="oldconf:Application">
228                 <xsl:text>&#10;        </xsl:text>
229                 <ApplicationOverride>
230                     <xsl:apply-templates select="@*"/>
231                     <xsl:apply-templates select="oldconf:Sessions"/>
232                     <xsl:apply-templates select="oldconf:Errors"/>
233                     <xsl:apply-templates select="oldconf:CredentialUse"/>
234                     <xsl:if test="count(oldconf:MetadataProvider) + count(oldconf:FederationProvider) > 0">
235                         <xsl:text>&#10;            </xsl:text>
236                         <MetadataProvider type="Chaining">
237                         <xsl:for-each select="oldconf:MetadataProvider|oldconf:FederationProvider">
238                             <xsl:text>&#10;                </xsl:text>
239                             <MetadataProvider type="XML" file="{@uri}"/>
240                         </xsl:for-each>
241                         <xsl:text>&#10;            </xsl:text>
242                         </MetadataProvider>
243                     </xsl:if>
244                     <xsl:text>&#10;&#10;        </xsl:text>
245                 </ApplicationOverride>
246             </xsl:for-each>
247        
248             <xsl:text>&#10;&#10;    </xsl:text>
249         </ApplicationDefaults>
250     </xsl:template>
251     
252     <xsl:template match="oldconf:Sessions">
253         <xsl:text>&#10;        </xsl:text>
254         <Sessions exportLocation="http://localhost/{@handlerURL}/GetAssertion">
255             <xsl:apply-templates select="@*"/>
256             <xsl:text>&#10;&#10;            </xsl:text>
257             <xsl:comment>
258                 <xsl:text>
259             SessionInitiators handle session requests and relay them to a Discovery page,
260             or to an IdP if possible. Automatic session setup will use the default or first
261             element (or requireSessionWith can specify a specific one to use).
262             </xsl:text>
263             </xsl:comment>
264             <xsl:for-each select="oldconf:SessionInitiator">
265                 <xsl:apply-templates select="."/>
266             </xsl:for-each>
267             <xsl:text>&#10;&#10;            </xsl:text>
268             <xsl:comment>
269                 <xsl:text>
270             md:AssertionConsumerService locations handle specific SSO protocol bindings,
271             such as SAML 2.0 POST or SAML 1.1 Artifact. The isDefault and index attributes
272             are used when sessions are initiated to determine how to tell the IdP where and
273             how to return the response.
274             </xsl:text>
275             </xsl:comment>
276             <xsl:text>&#10;            </xsl:text>
277             <md:AssertionConsumerService Location="/SAML2/POST" index="1" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
278             <xsl:text>&#10;            </xsl:text>
279             <md:AssertionConsumerService Location="/SAML2/POST-SimpleSign" index="2" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign"/>
280             <xsl:text>&#10;            </xsl:text>
281             <md:AssertionConsumerService Location="/SAML2/Artifact" index="3" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
282             <xsl:text>&#10;            </xsl:text>
283             <md:AssertionConsumerService Location="/SAML2/ECP" index="4" Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"/>
284             <xsl:text>&#10;            </xsl:text>
285             <md:AssertionConsumerService Location="/SAML/POST" index="5" Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post"/>
286             <xsl:text>&#10;            </xsl:text>
287             <md:AssertionConsumerService Location="/SAML/Artifact" index="6" Binding="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"/>
288             <xsl:text>&#10;&#10;            </xsl:text>
289
290             <!-- Turn the old local SLO location into the new LogoutInitiator location. -->
291             <xsl:variable name="LogoutLocation">
292                 <xsl:choose>
293                     <xsl:when test="md:SingleLogoutService[1]">
294                         <xsl:value-of select="md:SingleLogoutService[1]/@Location"/>
295                     </xsl:when>
296                     <xsl:otherwise>/Logout</xsl:otherwise>
297                 </xsl:choose>
298             </xsl:variable>
299            
300             <xsl:comment>
301             <xsl:text> LogoutInitiators enable SP-initiated local or global/single logout of sessions. </xsl:text>
302             </xsl:comment>
303             <xsl:text>&#10;            </xsl:text>
304             <LogoutInitiator type="Chaining" Location="{$LogoutLocation}" relayState="cookie">
305                 <xsl:text>&#10;                </xsl:text>
306                 <LogoutInitiator type="SAML2" template="bindingTemplate.html"/>
307                 <xsl:text>&#10;                </xsl:text>
308                 <LogoutInitiator type="Local"/>
309                 <xsl:text>&#10;            </xsl:text>
310             </LogoutInitiator>
311             <xsl:text>&#10;&#10;            </xsl:text>
312
313             <xsl:comment>
314             <xsl:text> md:SingleLogoutService locations handle single logout (SLO) protocol messages. </xsl:text>
315             </xsl:comment>
316             <xsl:text>&#10;            </xsl:text>
317             <md:SingleLogoutService Location="/SLO/SOAP" Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
318             <xsl:text>&#10;            </xsl:text>
319             <md:SingleLogoutService Location="/SLO/Redirect" conf:template="bindingTemplate.html" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"/>
320             <xsl:text>&#10;            </xsl:text>
321             <md:SingleLogoutService Location="/SLO/POST" conf:template="bindingTemplate.html" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
322             <xsl:text>&#10;            </xsl:text>
323             <md:SingleLogoutService Location="/SLO/Artifact" conf:template="bindingTemplate.html" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
324             <xsl:text>&#10;&#10;            </xsl:text>
325
326             <xsl:comment>
327             <xsl:text> md:ManageNameIDService locations handle NameID management (NIM) protocol messages. </xsl:text>
328             </xsl:comment>
329             <xsl:text>&#10;            </xsl:text>
330             <md:ManageNameIDService Location="/NIM/SOAP" Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
331             <xsl:text>&#10;            </xsl:text>
332             <md:ManageNameIDService Location="/NIM/Redirect" conf:template="bindingTemplate.html" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"/>
333             <xsl:text>&#10;            </xsl:text>
334             <md:ManageNameIDService Location="/NIM/POST" conf:template="bindingTemplate.html" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
335             <xsl:text>&#10;            </xsl:text>
336             <md:ManageNameIDService Location="/NIM/Artifact" conf:template="bindingTemplate.html" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
337             <xsl:text>&#10;&#10;            </xsl:text>
338
339             <xsl:comment>
340             <xsl:text>
341             md:ArtifactResolutionService locations resolve artifacts issued when using the
342             SAML 2.0 HTTP-Artifact binding on outgoing messages, generally uses SOAP.
343             </xsl:text>
344             </xsl:comment>
345             <xsl:text>&#10;            </xsl:text>
346             <md:ArtifactResolutionService Location="/Artifact/SOAP" index="1" Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
347             <xsl:text>&#10;&#10;            </xsl:text>
348
349             <xsl:comment>
350             <xsl:text> Extension service that generates "approximate" metadata based on SP configuration. </xsl:text>
351             </xsl:comment>
352             <xsl:text>&#10;            </xsl:text>
353             <Handler type="MetadataGenerator" Location="/Metadata" signing="false"/>
354             <xsl:text>&#10;&#10;            </xsl:text>
355            
356             <xsl:comment>
357             <xsl:text> Status reporting service. </xsl:text>
358             </xsl:comment>
359             <xsl:text>&#10;            </xsl:text>
360             <Handler type="Status" Location="Status" acl="127.0.0.1"/>
361             <xsl:text>&#10;&#10;            </xsl:text>
362
363             <xsl:comment>
364             <xsl:text> Session diagnostic service. </xsl:text>
365             </xsl:comment>
366             <xsl:text>&#10;            </xsl:text>
367             <Handler type="Session" Location="/Session"/>
368             <xsl:text>&#10;        </xsl:text>
369         </Sessions>
370         <xsl:text>&#10;</xsl:text>
371     </xsl:template>
372     
373     <xsl:template match="oldconf:SessionInitiator">
374         <xsl:text>&#10;&#10;            </xsl:text>
375         <SessionInitiator type="Chaining" Location="{@Location}" acsByIndex="false" relayState="cookie">
376             <xsl:if test="@id">
377                 <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
378             </xsl:if>
379             <xsl:if test="@isDefault">
380                 <xsl:attribute name="isDefault"><xsl:value-of select="@isDefault"/></xsl:attribute>
381             </xsl:if>
382             <xsl:if test="@Location=../oldconf:SessionInitiator[1]/@Location">
383                 <xsl:if test="$idp">
384                     <xsl:attribute name="entityID"><xsl:value-of select="$idp"/></xsl:attribute>
385                 </xsl:if>
386             </xsl:if>
387             <xsl:text>&#10;                </xsl:text>
388             <SessionInitiator type="SAML2" defaultACSIndex="1" ECP="true" template="bindingTemplate.html"/>
389             <xsl:text>&#10;                </xsl:text>
390             <SessionInitiator type="Shib1" defaultACSIndex="4"/>
391             <xsl:if test="@wayfURL">
392                 <xsl:if test="@wayfBinding='urn:mace:shibboleth:1.0:profiles:AuthnRequest'">
393                     <xsl:text>&#10;                </xsl:text>
394                     <SessionInitiator type="WAYF" URL="{@wayfURL}"/>
395                 </xsl:if>
396             </xsl:if>
397             <xsl:text>&#10;            </xsl:text>
398         </SessionInitiator>
399     </xsl:template>
400     
401     <!-- Map <Errors> element across, adding logout templates. -->
402     <xsl:template match="oldconf:Errors">
403         <xsl:text>&#10;        </xsl:text>
404         <Errors>
405             <xsl:apply-templates select="@*"/>
406             <xsl:attribute name="localLogout">localLogout.html</xsl:attribute>
407             <xsl:attribute name="globalLogout">globalLogout.html</xsl:attribute>
408             <xsl:text>&#10;        </xsl:text>
409         </Errors>
410         <xsl:text>&#10;</xsl:text>
411     </xsl:template>
412     
413     <!-- Map <CredentialUse> element content into relying party overrides. -->
414     <xsl:template match="oldconf:CredentialUse">
415         <xsl:for-each select="oldconf:RelyingParty">
416             <xsl:if test="@TLS">
417                 <xsl:text>&#10;        </xsl:text>
418                 <RelyingParty Name="{@Name}" keyName="{@TLS}"/>
419             </xsl:if>
420         </xsl:for-each>
421     </xsl:template>
422
423     <!-- Map legacy <FileResolver> elements to CredentialResolver plugins. -->
424     <xsl:template match="oldconf:CredentialsProvider">
425         <xsl:choose>
426             <xsl:when test="count(//cred:FileResolver) > 1">
427                 <xsl:text>        </xsl:text>
428                 <CredentialResolver type="Chaining">
429                     <xsl:text>&#10;</xsl:text>
430                     <xsl:apply-templates select="//cred:FileResolver">
431                         <xsl:with-param name="indent">12</xsl:with-param>
432                     </xsl:apply-templates>
433                     <xsl:text>        </xsl:text>
434                 </CredentialResolver>
435                 <xsl:text>&#10;</xsl:text>
436             </xsl:when>
437             <xsl:otherwise>
438                 <xsl:apply-templates select="//cred:FileResolver">
439                     <xsl:with-param name="indent">8</xsl:with-param>
440                 </xsl:apply-templates>
441             </xsl:otherwise>
442         </xsl:choose>
443     </xsl:template>
444     <xsl:template match="cred:FileResolver">
445         <xsl:param name="indent"/>
446         <xsl:value-of select="substring($spaces,0,$indent+1)"/>
447         <CredentialResolver type="File" key="{cred:Key/cred:Path/text()}" certificate="{cred:Certificate/cred:Path/text()}" keyName="{@Id}"/>
448         <xsl:text>&#10;</xsl:text>
449     </xsl:template>
450
451     <!-- Generic rule to pass through all element node content while converting the namespace. -->
452     <xsl:template match="oldconf:RequestMap|oldconf:Host|oldconf:HostRegex|oldconf:Path|oldconf:PathRegex|oldconf:htaccess|oldconf:AccessControl|oldconf:AND|oldconf:OR|oldconf:NOT">
453         <xsl:param name="indent"/>
454         <xsl:value-of select="substring($spaces,0,$indent+1)"/>
455         <xsl:element name="{name()}">
456             <xsl:apply-templates select="@*"/>
457             <xsl:text>&#10;</xsl:text>
458             <xsl:apply-templates select="./*">
459                 <xsl:with-param name="indent" select="$indent + 4"/>
460             </xsl:apply-templates>
461             <xsl:value-of select="substring($spaces,0,$indent+1)"/>
462         </xsl:element>
463         <xsl:text>&#10;</xsl:text>
464     </xsl:template>
465
466     <!-- Generic rule to pass through all attributes plus text content while converting the namespace. -->
467     <xsl:template match="oldconf:Rule">
468         <xsl:param name="indent"/>
469         <xsl:value-of select="substring($spaces,0,$indent+1)"/>
470         <xsl:element name="{name()}">
471             <xsl:apply-templates select="@*"/>
472             <xsl:value-of select="text()"/>
473         </xsl:element>
474         <xsl:text>&#10;</xsl:text>
475     </xsl:template>
476
477     <!-- Generic rule to pass through an attribute unmodified. -->
478     <xsl:template match="@*">
479         <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
480     </xsl:template>
481
482     <!-- Strips additional text nodes out of document. -->
483     <xsl:template match="text()"/>
484
485 </xsl:stylesheet>