Skip to content

Commit

Permalink
Exclude support addresses from the metadata.
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Jul 31, 2006
1 parent fc1631d commit a6b9079
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build/addresses.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
#
# Load addresses from the metadata.
#
open(XML,"../xml/sdss-metadata-unsigned.xml") || die "could not open input file";
# Exclude support addresses using some XSLT magic.
#
#open(XML,"../xml/sdss-metadata-unsigned.xml") || die "could not open input file";
open(XML,"java -cp ../xalan-j_2_6_0/bin/xalan.jar org.apache.xalan.xslt.Process -IN ../xml/sdss-metadata-unsigned.xml -XSL extract_addresses.xsl|") || die "could not open input file";
while (<XML>) {
if (/<EmailAddress>(mailto:)?(.*)<\/EmailAddress>/) {
$metadata{$2} = 1;
Expand Down
48 changes: 48 additions & 0 deletions build/extract_addresses.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
extract_addresses.xsl
XSL stylesheet that takes a SAML 2.0 metadata file and extracts
a list of contact e-mail addresses. Only administrative and
technical addresses are used; all others are dropped.
Author: Ian A. Young <ian@iay.org.uk>
$Id: extract_addresses.xsl,v 1.1 2006/07/31 14:42:41 iay Exp $
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wayf="http://sdss.ac.uk/2006/06/WAYF"
exclude-result-prefixes="shibmeta md ds wayf">

<!--Force UTF-8 encoding for the output.-->
<xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8" indent="yes"/>

<xsl:template match="/md:EntitiesDescriptor">
<Addresses>
<xsl:apply-templates select="md:EntityDescriptor/md:ContactPerson"/>
</Addresses>
</xsl:template>

<xsl:template match="md:ContactPerson[@contactType='support']">
<!-- do nothing -->
</xsl:template>

<xsl:template match="md:ContactPerson">
<xsl:apply-templates select="md:EmailAddress"/>
</xsl:template>

<xsl:template match="md:EmailAddress">
<EmailAddress><xsl:value-of select="."/></EmailAddress>
</xsl:template>
<!--By default, copy text blocks, comments and attributes unchanged.-->
<xsl:template match="text()|@*">
<xsl:copy/>
</xsl:template>

</xsl:stylesheet>

0 comments on commit a6b9079

Please sign in to comment.