Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Export the InCommon R&S category as the REFEDS one.
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Jul 3, 2014
1 parent 8cbdabc commit d485b26
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mdx/incommon/export.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
<!-- Include a default registrationAuthority for each entity. -->
<ref bean="us_incommon_default_regauth"/>

<!-- Replace the InCommon R&S category with the REFEDS equivalent. -->
<bean id="rands_to_refeds" parent="XSLTransformationStage"
p:id="rands_to_refeds">
<property name="XSLResource">
<bean parent="ClassPathResource">
<constructor-arg value="incommon/rands_to_refeds.xsl"/>
</bean>
</property>
</bean>

<!-- Construct an aggregate from the collection of entities. -->
<ref bean="assemble"/>

Expand Down
41 changes: 41 additions & 0 deletions mdx/incommon/rands_to_refeds.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
rands_to_refeds.xsl
Replace InCommon R&S entity category with REFEDS R&S.
-->
<xsl:stylesheet version="1.0"
xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdattr="urn:oasis:names:tc:SAML:metadata:attribute"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="md">

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

<xsl:template match="mdattr:EntityAttributes
/saml:Attribute[@Name='http://macedir.org/entity-category'][@NameFormat='urn:oasis:names:tc:SAML:2.0:attrname-format:uri']
/saml:AttributeValue[.='http://id.incommon.org/category/research-and-scholarship']">
<xsl:copy>
<xsl:text>http://refeds.org/category/research-and-scholarship</xsl:text>
</xsl:copy>
</xsl:template>

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

<!--By default, copy all elements from the input to the output, along with their attributes and contents.-->
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

0 comments on commit d485b26

Please sign in to comment.