Skip to content

Instantly share code, notes, and snippets.

@trscavo
Last active August 29, 2015 14:27
Show Gist options
  • Save trscavo/b721d760a8ef05ab3eaa to your computer and use it in GitHub Desktop.
Save trscavo/b721d760a8ef05ab3eaa to your computer and use it in GitHub Desktop.
An XSL stylesheet that extracts the entityIDs of all entities in a SAML 2.0 metadata file
<?xml version="1.0" encoding="UTF-8"?>
<!--
extract_all_entityIDs.xsl
XSL stylesheet that takes a SAML 2.0 metadata file and extracts
all entityIDs (both IdP and SP) as plain text.
-->
<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: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">
<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