Skip to content

Commit

Permalink
Remove the SDSSPolicy label from the test metadata stream. Include ad…
Browse files Browse the repository at this point in the history
…dional processing to prevent this from introducing non-schema-valid Extensions elements when no extensions are present (the Extensions element is wholly suppressed in this case).
  • Loading branch information
iay committed Feb 3, 2010
1 parent d49260b commit 14ba068
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions build/uk_master_test.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
xmlns:uklabel="http://ukfederation.org.uk/2006/11/label"

xmlns:date="http://exslt.org/dates-and-times"
xmlns:exsl="http://exslt.org/common"
xmlns:mdxDates="xalan://uk.ac.sdss.xalan.md.Dates"
extension-element-prefixes="date mdxDates"
extension-element-prefixes="date exsl mdxDates"

xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
exclude-result-prefixes="wayf">
Expand Down Expand Up @@ -87,11 +88,32 @@
<xsl:text>&#10;</xsl:text>
</xsl:template>

<!--
Handle <md:Extensions> elements.
In general, at this stage in the flow we pass through any Extensions unaltered.
However, certain changes (such as the filtering we perform on extensions in the
uklabel namespace) may cause the Extensions element to become empty, which is not
permitted by the schema. We therefore precompute the resulting Extensions element
and suppress it entirely if it would have no child elements.
-->
<xsl:template match="md:Extensions">
<!-- compute result -->
<xsl:variable name="ext">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:variable>
<!-- copy through only if schema-valid -->
<xsl:if test="count(exsl:node-set($ext)/md:Extensions/*) != 0">
<xsl:copy-of select="$ext"/>
</xsl:if>
</xsl:template>

<!--
Pass through certain uklabel namespace elements.
-->
<xsl:template match="uklabel:UKFederationMember |
uklabel:SDSSPolicy |
uklabel:AccountableUsers">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
Expand Down

0 comments on commit 14ba068

Please sign in to comment.