Skip to content

Commit

Permalink
Normalise namespaces in import aggregate.
Browse files Browse the repository at this point in the history
In particular, exclude the ukf-specific namespaces, which will never
occur here.
  • Loading branch information
iay committed May 27, 2015
1 parent 04b3855 commit 0a8e63d
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mdx/incommon/import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,14 @@
</bean>

<!-- Normalise the use of namespace prefixes in the resulting XML document. -->
<ref bean="normaliseNamespaces"/>
<bean id="normalise" parent="XSLTransformationStage"
p:id="normalise">
<property name="XSLResource">
<bean parent="FileSystemResource">
<constructor-arg value="${incdir}/ns_norm_import.xsl"/>
</bean>
</property>
</bean>

<!-- Write the resulting aggregate out to a file. -->
<ref bean="serializeImported"/>
Expand Down
76 changes: 76 additions & 0 deletions mdx/incommon/ns_norm_import.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
ns_norm_import.xsl
Normalise the namespaces in a metadata file for import.
-->
<xsl:stylesheet version="1.0"
xmlns:alg="urn:oasis:names:tc:SAML:metadata:algsupport"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:idpdisc="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol"
xmlns:init="urn:oasis:names:tc:SAML:profiles:SSO:request-init"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdattr="urn:oasis:names:tc:SAML:metadata:attribute"
xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"
xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"
xmlns:ukfedlabel="http://ukfederation.org.uk/2006/11/label"
xmlns:wayf="http://sdss.ac.uk/2006/06/WAYF"

exclude-result-prefixes="md mdattr saml ukfedlabel wayf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="urn:oasis:names:tc:SAML:2.0:metadata">


<!--
Import templates for basic normalisation.
-->
<xsl:import href="../ns_norm.xsl"/>


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


<!--
*******************************************
*** ***
*** D O C U M E N T E L E M E N T ***
*** ***
*******************************************
-->


<!--
We need to handle the document element specially in order to arrange
for all appropriate namespace prefix definitions to appear on it.
There are only two possible document elements in SAML metadata.
-->


<!--
Document element is <EntityDescriptor>.
-->
<xsl:template match="/md:EntityDescriptor">
<EntityDescriptor>
<xsl:apply-templates select="node()|@*"/>
</EntityDescriptor>
</xsl:template>

<!--
Document element is <EntitiesDescriptor>.
-->
<xsl:template match="/md:EntitiesDescriptor">
<EntitiesDescriptor>
<xsl:apply-templates select="node()|@*"/>
</EntitiesDescriptor>
</xsl:template>

</xsl:stylesheet>

0 comments on commit 0a8e63d

Please sign in to comment.