Skip to content

Instantly share code, notes, and snippets.

@trscavo
Created January 6, 2016 14:20
Show Gist options
  • Save trscavo/64b5881df1347b4282ec to your computer and use it in GitHub Desktop.
Save trscavo/64b5881df1347b4282ec to your computer and use it in GitHub Desktop.
An XSL stylesheet that takes a SAML 2.0 metadata file and extracts the non-InCommon IdP entityIDs as plain text.
<?xml version="1.0" encoding="UTF-8"?>
<!--
extract_non-InCommon_IdP_entityIDs.xsl
XSL stylesheet that takes a SAML 2.0 metadata file and extracts the
non-InCommon IdP entityIDs as plain text. An entity is not an InCommon
IdP if its registar ID is something other than the InCommon registrar
ID "https://incommon.org".
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="xs md">
<!-- Output is plain text -->
<xsl:output method="text"/>
<xsl:template match="//md:EntityDescriptor[md:IDPSSODescriptor][md:Extensions/mdrpi:RegistrationInfo[@registrationAuthority!='https://incommon.org']]">
<xsl:value-of select="@entityID"/>
<xsl:text>&#x0a;</xsl:text>
</xsl:template>
<xsl:template match="text()">
<!-- do nothing -->
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment