summaryrefslogtreecommitdiff
path: root/xslt/import-mdservicelist.xsl
blob: fb7522b91554a97b9aa47cf381d827905036c586 (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
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
                xmlns:ser="http://eidas.europa.eu/metadata/servicelist"
                xmlns:exsl="http://exslt.org/common"
                extension-element-prefixes="exsl">

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

  <xsl:template match="/ser:MetadataServiceList">
    <xsl:apply-templates select="ser:MetadataList"/>
  </xsl:template>

  <xsl:template match="ser:MetadataList">
    <xsl:variable name="country">
       <xsl:value-of select="@Territory"/>
    </xsl:variable>

    <xsl:variable name="file" select="concat($output,'/',$country,'.xml')"/>
    <exsl:document method="xml" indent="yes" href="{$file}">
      <xsl:copy>
        <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
    </exsl:document>
  </xsl:template>

  <xsl:template match="@ID"/>
  <xsl:template match="ds:Signature"/>

  <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>