Skip to content

Commit

Permalink
Add validUntil support to the export metadata stream. Add second comm…
Browse files Browse the repository at this point in the history
…ent block to output. Filter out top level text nodes, which mostly end up as (lots of) vertical white space.
  • Loading branch information
iay committed Sep 21, 2009
1 parent fdfcdd3 commit 8601d98
Showing 1 changed file with 54 additions and 3 deletions.
57 changes: 54 additions & 3 deletions build/uk_master_export.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,55 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wayf="http://sdss.ac.uk/2006/06/WAYF"
xmlns:uklabel="http://ukfederation.org.uk/2006/11/label"

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

xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
exclude-result-prefixes="wayf">

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

<!--
validityDays
This parameter determines the number of days between the aggregation instant and the
end of validity of the signed metadata.
-->
<xsl:variable name="validityDays" select="14"/>

<xsl:variable name="now" select="date:date-time()"/>
<xsl:variable name="validUntil" select="mdxDates:dateAdd($now, $validityDays)"/>

<!--
Add a comment to the start of the output file.
Document root.
-->
<xsl:template match="/">
<xsl:call-template name="document.comment"/>
<xsl:apply-templates/>
</xsl:template>

<!--
Document element.
-->
<xsl:template match="/md:EntitiesDescriptor">
<xsl:copy>
<xsl:attribute name="validUntil">
<xsl:value-of select="$validUntil"/>
</xsl:attribute>
<xsl:apply-templates select="@*"/>
<xsl:call-template name="document.comment"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>

<!--
Comment to be added to the top of the document, and just inside the document element.
-->
<xsl:template name="document.comment">
<xsl:text>&#10;</xsl:text>
<xsl:comment>
<xsl:text>&#10;&#9;U K F E D E R A T I O N M E T A D A T A&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
Expand All @@ -40,10 +76,25 @@
<xsl:text>&#9;Aggregate built </xsl:text>
<xsl:value-of select="$now"/>
<xsl:text>&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>&#9;Aggregate valid for </xsl:text>
<xsl:value-of select="$validityDays"/>
<xsl:text> days, until </xsl:text>
<xsl:value-of select="$validUntil"/>
<xsl:text>&#10;</xsl:text>
</xsl:comment>
<xsl:apply-templates/>
<xsl:text>&#10;</xsl:text>
</xsl:template>


<!--
Drop text nodes inside the document element. There's one of these for each
EntityDescriptor in the original document, so without this most of the output
file is blank.
-->
<xsl:template match="md:EntitiesDescriptor/text()">
<!-- do nothing -->
</xsl:template>

<!--
Drop the federation-specific key authority information.
Expand Down

0 comments on commit 8601d98

Please sign in to comment.