summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2013-06-28 13:12:19 +0200
committerLeif Johansson <leifj@sunet.se>2013-06-28 13:12:19 +0200
commit5c0499818c865da4918e2cf85a04378548f6738e (patch)
tree33d5a47b1c0142ac3d6b96b5f651ee4e4fbf947d
parentf7d36f345a8bcfded0017a4b215ff0692b9f6307 (diff)
parent54368ff640284e05a307b318d4a13b421177d389 (diff)
Merge branch 'master' of md-master.swamid.se:swamid-metadata
-rw-r--r--xslt/sp-summary.xslt65
1 files changed, 51 insertions, 14 deletions
diff --git a/xslt/sp-summary.xslt b/xslt/sp-summary.xslt
index 2e0981df..cc6b0056 100644
--- a/xslt/sp-summary.xslt
+++ b/xslt/sp-summary.xslt
@@ -5,6 +5,8 @@
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:mdattr="urn:oasis:names:tc:SAML:metadata:attribute"
+ xmlns:samla="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
xmlns:shibmd="urn:mace:shibboleth:metadata:1.0">
@@ -26,18 +28,19 @@
</xsl:template>
<xsl:template match="/md:EntitiesDescriptor">
- <xsl:text>||EntityID||Service Name||Service Description||Organization||Technical Contact||Administrative Contact||
+ <xsl:text>||EntityID||Service Name||Service Description||Organization||Technical Contact||Administrative Contact||Entity Categories||
</xsl:text>
<xsl:apply-templates select="md:EntityDescriptor[md:SPSSODescriptor]"/>
</xsl:template>
<xsl:template match="md:EntityDescriptor">
- <xsl:text> | </xsl:text><xsl:value-of select="@entityID"/><xsl:text> </xsl:text>
- <xsl:text> | </xsl:text><xsl:apply-templates select="md:SPSSODescriptor/md:AttributeConsumingService/md:ServiceName"/><xsl:text> </xsl:text>
- <xsl:text> | </xsl:text><xsl:apply-templates select="md:SPSSODescriptor/md:AttributeConsumingService/md:ServiceDescription"/><xsl:text> </xsl:text>
- <xsl:text> | </xsl:text><xsl:apply-templates select="md:Organization"/><xsl:text> </xsl:text>
- <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@contactType='technical']"/><xsl:text> </xsl:text>
- <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@contactType='administrative']"/><xsl:text>|
+ <xsl:text> | </xsl:text><xsl:value-of select="@entityID"/>
+ <xsl:text> | </xsl:text><xsl:apply-templates select="md:SPSSODescriptor/md:AttributeConsumingService/md:ServiceName"/>
+ <xsl:text> | </xsl:text><xsl:apply-templates select="md:SPSSODescriptor/md:AttributeConsumingService/md:ServiceDescription"/>
+ <xsl:text> | </xsl:text><xsl:apply-templates select="md:Organization"/>
+ <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@contactType='technical']"/>
+ <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@contactType='administrative']"/>
+ <xsl:text> | </xsl:text><xsl:apply-templates select="md:Extensions/mdattr:EntityAttributes/samla:Attribute[@Name='http://macedir.org/entity-category']/samla:AttributeValue"/><xsl:text> |
</xsl:text>
</xsl:template>
@@ -46,20 +49,34 @@
</xsl:template>
<xsl:template match="md:ServiceDescription">
- <xsl:value-of select="text()"/>
+ <xsl:value-of select="normalize-space(text())"/><xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="md:ServiceName">
- <xsl:value-of select="text()"/>
+ <xsl:call-template name="string-replace-all">
+ <xsl:with-param name="text" select="text()" />
+ <xsl:with-param name="replace" select="'|'" />
+ <xsl:with-param name="by" select="'\|'" />
+ </xsl:call-template>
</xsl:template>
+ <xsl:template match="samla:AttributeValue">
+ <xsl:call-template name="string-replace-all">
+ <xsl:with-param name="text" select="substring-after(text(),'/category/')" />
+ <xsl:with-param name="replace" select="'-'" />
+ <xsl:with-param name="by" select="'&amp;#x2011;'" />
+ </xsl:call-template>
+ <xsl:text>\\</xsl:text>
+ </xsl:template>
+
<xsl:template match="md:ContactPerson">
- <xsl:apply-templates select="md:EmailAddress"/><xsl:text> </xsl:text>
+ <xsl:apply-templates select="md:EmailAddress"/>
</xsl:template>
<xsl:template match="md:Organization">
<xsl:text>[</xsl:text>
- <xsl:apply-templates select="md:OrganizationDisplayName[1]"/><xsl:text>|</xsl:text><xsl:apply-templates select="md:OrganizationURL[1]"/><xsl:text>]</xsl:text>
+ <xsl:apply-templates select="md:OrganizationDisplayName[1]"/><xsl:text>|</xsl:text>
+ <xsl:apply-templates select="md:OrganizationURL[1]"/><xsl:text>]</xsl:text>
</xsl:template>
<xsl:template match="md:SPPSSODescriptor">
@@ -67,15 +84,15 @@
</xsl:template>
<xsl:template match="md:EmailAddress">
- <xsl:value-of select="text()"/>
+ <xsl:value-of select="text()"/><xsl:text>\\</xsl:text>
</xsl:template>
<xsl:template match="md:OrganizationDisplayName">
- <xsl:value-of select="text()"/>
+ <xsl:value-of select="normalize-space(text())"/>
</xsl:template>
<xsl:template match="md:OrganizationURL">
- <xsl:value-of select="text()"/>
+ <xsl:value-of select="normalize-space(text())"/>
</xsl:template>
<xsl:template match="shibmd:Scope">
@@ -86,4 +103,24 @@
<xsl:template match="*"/>
<xsl:template match="text()"/>
+ <xsl:template name="string-replace-all">
+ <xsl:param name="text" />
+ <xsl:param name="replace" />
+ <xsl:param name="by" />
+ <xsl:choose>
+ <xsl:when test="contains($text, $replace)">
+ <xsl:value-of select="substring-before($text,$replace)" />
+ <xsl:value-of select="$by" />
+ <xsl:call-template name="string-replace-all">
+ <xsl:with-param name="text" select="substring-after($text,$replace)" />
+ <xsl:with-param name="replace" select="$replace" />
+ <xsl:with-param name="by" select="$by" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
</xsl:stylesheet>