summaryrefslogtreecommitdiff
path: root/xslt/mdslgen.xsl
blob: ac0110a8de2b612468a3463f2db34c01ad40d2d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xi="http://www.w3.org/2001/XInclude" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
                xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
                xmlns:ser="http://eidas.europa.eu/metadata/servicelist"
                xmlns:exsl="http://exslt.org/common"
                extension-element-prefixes="exsl"
                xmlns:shibmd="urn:mace:shibboleth:metadata:1.0">

  <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
  <xsl:param name="type"/>

  <xsl:template match="//xi:include">
     <xsl:apply-templates select="document(@href)">
        <with-param name="type"><xsl:value-of select="@type"/></with-param>
     </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="md:EntityDescriptor">
     <ser:MetadataLocation>
        <xsl:attribute name="Location"><xsl:value-of select="@entityID"/></xsl:attribute>
        <ser:Endpoint>
           <xsl:attribute name="EndpointType"><xsl:value-of select="$type"/></xsl:attribute>
           <xsl:attribute name="EntityID"><xsl:value-of select="@entityID"/></xsl:attribute>
        </ser:Endpoint>
        <xsl:apply-templates select="ds:Signature"/>
     </ser:MetadataLocation>
  </xsl:template>

  <xsl:template match="ds:Signature">
     <xsl:apply-templates select="ds:KeyInfo"/>
  </xsl:template>

  <xsl:template match="ds:KeyInfo">
     <xsl:copy>
        <xsl:apply-templates/>
     </xsl:copy>
  </xsl:template>
   
  <xsl:template match="text()|comment()|@*">
    <xsl:copy/>
  </xsl:template>
  
  <xsl:template match="*">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>