Skip to content

Commit

Permalink
Stop using sdss-xalan-md project
Browse files Browse the repository at this point in the history
Remove date handling from final-tweak.xsl.
See ukf/ukf-meta#139.
  • Loading branch information
iay committed Oct 23, 2019
1 parent f357f0b commit d5f4917
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
10 changes: 10 additions & 0 deletions mdx/common-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@
<bean id="now_ISO" parent="String" c:_="#{ now_instant.toString() }"/>
<bean id="now_date_ISO" parent="String" c:_="#{ now_ISO.substring(0,10) }"/>

<!--
The now_instant as a local date/time (in the system default
timezone), and as an ISO 8601 representation of that.
-->
<bean id="now_local" class="java.time.LocalDateTime"
factory-method="ofInstant"
c:_0-ref="now_instant"
c:_1="#{ T(java.time.ZoneId).systemDefault() }"/>
<bean id="now_local_ISO" parent="String" c:_="#{ now_local.toString() }"/>

<!--
***********************************************
*** ***
Expand Down
37 changes: 27 additions & 10 deletions mdx/uk/final_tweak.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"

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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
Expand Down Expand Up @@ -46,8 +42,25 @@
-->
<xsl:param name="validityDays"/>

<xsl:variable name="now" select="date:date-time()"/>
<xsl:variable name="normalisedNow" select="mdxDates:dateAdd($now, 0)"/>
<!--
now_ISO
This parameter is an ISO8601 representation of the UTC instant
at which the aggregate generation started.
Example: 2019-10-23T10:25:11Z
-->
<xsl:param name="now_ISO"/>

<!--
now_local_ISO
This parameter is an ISO8601 representation of the local time
at which the aggregate generation started.
Example: 2019-10-23T11:25:11
-->
<xsl:param name="now_local_ISO"/>

<!--
Document element.
Expand Down Expand Up @@ -97,10 +110,14 @@
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:text>&#9;Aggregate built </xsl:text>
<xsl:value-of select="$normalisedNow"/>
<xsl:if test="string($normalisedNow) != string($now)">
<xsl:value-of select="$now_ISO"/>
<!--
Show local time if DST is in effect (indicated by the local
hour and UTC hour being different), otherwise omit.
-->
<xsl:if test="substring($now_ISO, 12, 2) != substring($now_local_ISO, 12, 2)">
<xsl:text> (</xsl:text>
<xsl:value-of select="$now"/>
<xsl:value-of select="$now_local_ISO"/>
<xsl:text> local)</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
Expand Down Expand Up @@ -141,7 +158,7 @@
<xsl:value-of select="$publisher"/>
</xsl:attribute>
<xsl:attribute name="creationInstant">
<xsl:value-of select="$normalisedNow"/>
<xsl:value-of select="$now_ISO"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
Expand Down
10 changes: 10 additions & 0 deletions mdx/uk/generate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@
<map>
<entry key="publisher" value-ref="uk_federation_uri"/>
<entry key="validityDays" value="${validUntil.aggregate.days}"/>
<entry key="now_ISO" value-ref="now_ISO"/>
<entry key="now_local_ISO" value-ref="now_local_ISO"/>
</map>
</property>
</bean>
Expand Down Expand Up @@ -434,6 +436,8 @@
value="Central Discovery Service metadata; not for end entity use"/>
<entry key="publisher" value-ref="uk_federation_uri"/>
<entry key="validityDays" value="${validUntil.aggregate.days}"/>
<entry key="now_ISO" value-ref="now_ISO"/>
<entry key="now_local_ISO" value-ref="now_local_ISO"/>
</map>
</property>
</bean>
Expand Down Expand Up @@ -516,6 +520,8 @@
<entry key="extraText" value="Feature fallback metadata; not for production use"/>
<entry key="publisher" value-ref="uk_federation_uri"/>
<entry key="validityDays" value="${validUntil.aggregate.days}"/>
<entry key="now_ISO" value-ref="now_ISO"/>
<entry key="now_local_ISO" value-ref="now_local_ISO"/>
</map>
</property>
</bean>
Expand Down Expand Up @@ -573,6 +579,8 @@
<entry key="extraText" value="Feature test metadata; not for production use"/>
<entry key="publisher" value-ref="uk_federation_uri"/>
<entry key="validityDays" value="${validUntil.aggregate.days}"/>
<entry key="now_ISO" value-ref="now_ISO"/>
<entry key="now_local_ISO" value-ref="now_local_ISO"/>
</map>
</property>
</bean>
Expand Down Expand Up @@ -627,6 +635,8 @@
<entry key="extraText" value="Export metadata for use by partner federations"/>
<entry key="publisher" value-ref="uk_federation_uri"/>
<entry key="validityDays" value="${validUntil.aggregate.days}"/>
<entry key="now_ISO" value-ref="now_ISO"/>
<entry key="now_local_ISO" value-ref="now_local_ISO"/>
</map>
</property>
</bean>
Expand Down

0 comments on commit d5f4917

Please sign in to comment.