Synch'd metadata transformation files from /c.
[java-idp.git] / src / schemas / trust_v12_to_v11.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3         v12_to_v11_trust.xsl
4         
5         XSL stylesheet converting a Shibboleth 1.2 trust metadata file into the equivalent for
6         Shibboleth 1.1.
7
8         Author: Ian A. Young <ian@iay.org.uk>
9
10         $Id$
11 -->
12 <xsl:stylesheet version="1.0"
13         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
14         xmlns:shibb10="urn:mace:shibboleth:1.0"
15         xmlns:trust10="urn:mace:shibboleth:trust:1.0"
16         xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
17         xmlns="urn:mace:shibboleth:1.0"
18         exclude-result-prefixes="shibb10 trust10">
19         
20         <!--
21                 Version information for this file.  Remember to peel off the dollar signs
22                 before dropping the text into another versioned file.
23         -->
24         <xsl:param name="cvsId">$Id$</xsl:param>
25
26         <!--
27                 Add a comment to the start of the output file.
28         -->
29         <xsl:template match="/">
30                 <xsl:comment>
31                         <xsl:text>&#10;&#9;***DO NOT EDIT THIS FILE***&#10;&#10;</xsl:text>
32                         <xsl:text>&#9;Converted by:&#10;&#10;&#9;</xsl:text>
33                         <xsl:value-of select="substring-before(substring-after($cvsId, ': '), '$')"/>
34                         <xsl:text>&#10;</xsl:text>
35                 </xsl:comment>
36                 <xsl:apply-templates/>
37         </xsl:template>
38
39         <!--Force UTF-8 encoding for the output.-->
40         <xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8" indent="yes"/>
41
42         <!--trust10:Trust is the root element for the trust file.  Process it by changing the default namespace used and recursing.-->
43         <xsl:template match="trust10:Trust">
44                 <Trust>
45                         <!-- <xsl:apply-templates select="@*"/> -->
46                         <xsl:apply-templates/>
47                 </Trust>
48         </xsl:template>
49
50         <!--trust10:KeyAuthority appears in the trust file, and needs its namespace changing.  After that, we need to reorder its nested elements a little.-->
51         <xsl:template match="trust10:KeyAuthority">
52                 <KeyAuthority>
53                         <xsl:apply-templates select="ds:KeyInfo"/>
54                         <Subject>
55                                 <xsl:value-of select="ds:KeyName"/>
56                         </Subject>
57                 </KeyAuthority>
58         </xsl:template>
59
60         <!--
61                 Generic recursive copy for ds:* elements.
62                 
63                 This works better than an xsl:copy-of because it does not copy across spurious
64                 namespace nodes.
65         -->
66         <xsl:template match="ds:*">
67                 <xsl:element name="{name()}">
68                         <xsl:apply-templates select="ds:* | text() | comment() | @*"/>
69                 </xsl:element>
70         </xsl:template>
71
72         <!--By default, copy text blocks, comments and attributes unchanged.-->
73         <xsl:template match="text()|comment()|@*">
74                 <xsl:copy/>
75         </xsl:template>
76
77         <!--By default, copy all elements from the input to the output, along with their attributes and contents.-->
78         <xsl:template match="*">
79                 <xsl:copy>
80                         <xsl:apply-templates select="node()|@*"/>
81                 </xsl:copy>
82         </xsl:template>
83
84 </xsl:stylesheet>
85