1 <?xml version="1.0" encoding="UTF-8"?>
6 XSL stylesheet converting a SAML 2 metadata file describing a Shibboleth
7 1.3 federation into the equivalent Shibboleth 1.2 trust file.
9 Author: Ian A. Young <ian@iay.org.uk>
13 <xsl:stylesheet version="1.0"
14 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
15 xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
16 xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0"
17 xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
18 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19 xmlns="urn:mace:shibboleth:trust:1.0"
20 exclude-result-prefixes="shibmeta md">
23 Version information for this file. Remember to peel off the dollar signs
24 before dropping the text into another versioned file.
26 <xsl:param name="cvsId">$Id$</xsl:param>
29 Add a comment to the start of the output file.
31 <xsl:template match="/">
33 <xsl:text> 	***DO NOT EDIT THIS FILE*** </xsl:text>
34 <xsl:text>	Converted by: 	</xsl:text>
35 <xsl:value-of select="substring-before(substring-after($cvsId, ': '), '$')"/>
36 <xsl:text> </xsl:text>
39 <xsl:attribute name="xsi:schemaLocation">
40 <xsl:text>urn:mace:shibboleth:trust:1.0 shibboleth-trust-1.0.xsd </xsl:text>
41 <xsl:text>http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd</xsl:text>
43 <xsl:apply-templates/>
47 <!--Force UTF-8 encoding for the output.-->
48 <xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8" indent="yes"/>
51 Extract a KeyAuthority extension from an EntitiesDescriptor.
53 <xsl:template match="md:EntitiesDescriptor">
55 <!-- extract KeyAuthority metadata, if any -->
56 <xsl:if test="md:Extensions/shibmeta:KeyAuthority/ds:KeyInfo">
57 <xsl:apply-templates select="md:Extensions/shibmeta:KeyAuthority">
58 <xsl:with-param name="name" select="@Name"/>
59 </xsl:apply-templates>
62 <!-- proceed to nested EntitiesDescriptor and EntityDescriptor elements -->
63 <xsl:apply-templates select="md:EntitiesDescriptor | md:EntityDescriptor"/>
67 Extract a KeyAuthority extension from an EntityDescriptor.
69 <xsl:template match="md:EntityDescriptor">
70 <!-- extract KeyAuthority metadata, if any -->
71 <xsl:if test="md:Extensions/shibmeta:KeyAuthority/ds:KeyInfo">
72 <xsl:apply-templates select="md:Extensions/shibmeta:KeyAuthority">
73 <xsl:with-param name="name" select="@entityID"/>
74 </xsl:apply-templates>
79 Map shibmeta:KeyAuthority to trust:KeyAuthority
81 <xsl:template match="shibmeta:KeyAuthority">
82 <xsl:param name="name"/>
84 <!-- copy across VerifyDepth attribute if present -->
85 <xsl:apply-templates select="@VerifyDepth"/>
87 <!-- generate KeyName -->
89 <xsl:value-of select="$name"/>
92 <!-- generate single output KeyInfo element -->
94 <!-- extract the insides of all KeyInfo elements in the input -->
95 <xsl:apply-templates select="text() | comment() | ds:KeyInfo/* | ds:KeyInfo/comment() | ds:KeyInfo/text()"/>
101 Generic recursive copy for ds:* elements.
103 This works better than an xsl:copy-of because it does not copy across spurious
106 <xsl:template match="ds:*">
107 <xsl:element name="{name()}">
108 <xsl:apply-templates select="ds:* | text() | comment() | @*"/>
113 By default, copy referenced attributes through unchanged.
115 <xsl:template match="@*">
116 <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
120 By default, copy comments and text nodes through to the output unchanged.
122 <xsl:template match="text()|comment()">