Skip to content

Commit

Permalink
Scope-counting utility.
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Apr 24, 2009
1 parent 67f5156 commit 57ead4c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions build/count_scopes.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/perl -w

open(XML,"java -cp ../xalan-j_2_6_0/bin/xalan.jar org.apache.xalan.xslt.Process -IN ../xml/ukfederation-metadata-unsigned.xml -XSL extract_scopes.xsl|") || die "could not open input file";
while (<XML>) {
# print $_;
chop;
my $scope = $_;
$scopes{$scope} = 1;
}
close XML;

print scalar(keys(%scopes)), "\n";
36 changes: 36 additions & 0 deletions build/extract_scopes.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
extract_nocert_locs.xsl
XSL stylesheet that takes a SAML 2.0 metadata file and extracts
a list of scopes used. Regular expression scopes are ignored.
Author: Ian A. Young <ian@iay.org.uk>
-->
<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">

<!-- Output is plain text -->
<xsl:output method="text"/>

<xsl:template match="//shibmeta:Scope[@regex = 'true']">
<!-- do nothing -->
</xsl:template>

<xsl:template match="//shibmeta:Scope">
<xsl:value-of select="."/>
<xsl:text>&#x0a;</xsl:text>
</xsl:template>

<xsl:template match="text()">
<!-- do nothing -->
</xsl:template>
</xsl:stylesheet>

0 comments on commit 57ead4c

Please sign in to comment.