summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2010-12-14 13:06:45 +0100
committerLeif Johansson <leifj@sunet.se>2010-12-14 13:06:45 +0100
commit3e2e25ba1d8284486a2616e631b1eb716117f51e (patch)
tree39f978e31ededac23d0a20d00046b6c612d42a78
parent90ca6383543be2ab536728b94071d52ff4eec784 (diff)
local copy of import xslt - slightly modified from saml-md-tools original
-rw-r--r--xslt/import-metadata.xsl52
1 files changed, 52 insertions, 0 deletions
diff --git a/xslt/import-metadata.xsl b/xslt/import-metadata.xsl
new file mode 100644
index 00000000..7c3a9991
--- /dev/null
+++ b/xslt/import-metadata.xsl
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ 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: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:template match="/md:EntitiesDescriptor">
+ <xsl:apply-templates select="md:EntityDescriptor">
+ <!-- xsl:with-param name="output"><xsl:value-of select="$output"/></xsl:with-param -->
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="md:EntityDescriptor">
+ <!-- xsl:param name="output"/ -->
+ <xsl:variable name="uri"><xsl:value-of select="substring-after(@entityID,'://')"/></xsl:variable>
+ <xsl:variable name="host">
+ <xsl:if test="contains($uri,'/')">
+ <xsl:value-of select="substring-before($uri,'/')"/>
+ </xsl:if>
+ <xsl:if test="not(contains($uri,'/'))">
+ <xsl:value-of select="$uri"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="file" select="concat($output,'/',$host,'.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>