Skip to content

Commit

Permalink
Stop using sdss-xalan-md project
Browse files Browse the repository at this point in the history
See ukf/ukf-meta#139.
  • Loading branch information
iay committed Oct 22, 2019
1 parent cec199d commit f357f0b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
29 changes: 29 additions & 0 deletions mdx/common-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
Java class parent shorthand beans.
-->
<bean id="File" abstract="true" class="java.io.File"/>
<bean id="Instant" abstract="true" class="java.time.Instant"/>
<bean id="String" abstract="true" class="java.lang.String"/>
<bean id="QName" abstract="true" class="javax.xml.namespace.QName"/>

Expand Down Expand Up @@ -141,6 +142,34 @@
<!-- *** Default Shibboleth component bean id property from Spring bean id *** -->
<bean class="net.shibboleth.ext.spring.config.IdentifiableBeanPostProcessor" lazy-init="false"/>

<!--
*******************************************************
*** ***
*** D A T E A N D T I M E H A N D L I N G ***
*** ***
*******************************************************
-->

<!--
Approximately when the Spring context was initialised,
as a java.time.Instant.
-->
<bean id="now_instant_raw" parent="Instant" factory-method="now"/>

<!--
now_instant_raw can have any precision. To get somewhat consistent
output, derive a new now_instant that truncates that to the second.
-->
<bean id="now_instant" parent="Instant" factory-method="from"
c:_="#{ now_instant_raw.truncatedTo(T(java.time.temporal.ChronoUnit).SECONDS) }"/>

<!--
Strings representing now_instant as an ISO 8601 UTC date/time
and as an ISO 8601 date.
-->
<bean id="now_ISO" parent="String" c:_="#{ now_instant.toString() }"/>
<bean id="now_date_ISO" parent="String" c:_="#{ now_ISO.substring(0,10) }"/>

<!--
***********************************************
*** ***
Expand Down
14 changes: 9 additions & 5 deletions mdx/uk/import.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"
xmlns:ukfedlabel="http://ukfederation.org.uk/2006/11/label"

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

xmlns:xalan="http://xml.apache.org/xalan"

Expand All @@ -56,6 +54,12 @@
indent="yes" xalan:indent-amount="4"
/>

<!--
Parameters passed in from verbs.xml.
-->
<xsl:param name="now_ISO"/>
<xsl:param name="now_date_ISO"/>

<xsl:strip-space elements="md:EntityDescriptor"/>

<!--
Expand Down Expand Up @@ -136,7 +140,7 @@
-->
<ukfedlabel:Software name="*** FILL IN ***"
version="*** FILL IN OR REMOVE ***" fullVersion="*** FILL IN OR REMOVE ***">
<xsl:attribute name="date"><xsl:value-of select="mdxDates:date()"/></xsl:attribute>
<xsl:attribute name="date"><xsl:value-of select="$now_date_ISO"/></xsl:attribute>
</ukfedlabel:Software>

<!--
Expand All @@ -153,7 +157,7 @@
<xsl:element name="mdrpi:RegistrationInfo">
<xsl:attribute name="registrationAuthority">http://ukfederation.org.uk</xsl:attribute>
<xsl:attribute name="registrationInstant">
<xsl:value-of select="mdxDates:dateAdd(date:date-time(), 0)"/>
<xsl:value-of select="$now_ISO"/>
</xsl:attribute>
<xsl:element name="mdrpi:RegistrationPolicy">
<xsl:attribute name="xml:lang">en</xsl:attribute>
Expand Down
9 changes: 8 additions & 1 deletion mdx/uk/verbs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,14 @@

<!-- transform into a fragment using our local conventions -->
<bean id="importTransform" parent="mda.XSLTransformationStage"
p:XSLResource="classpath:uk/import.xsl"/>
p:XSLResource="classpath:uk/import.xsl">
<property name="transformParameters">
<map>
<entry key="now_ISO" value-ref="now_ISO"/>
<entry key="now_date_ISO" value-ref="now_date_ISO"/>
</map>
</property>
</bean>

<!-- normalise namespaces in a specific way -->
<bean id="normalizeFragment" parent="mda.XSLTransformationStage"
Expand Down

0 comments on commit f357f0b

Please sign in to comment.