Set when-iso to today
Jump to navigation
Jump to search
The code below is intended to offer a quick fix for an empty @when-iso
element by suggesting the insertion of either today's date or the current date and time in ISO-compliant form. It is ideal for <change>
elements, to save time in typing the day or time when a change was made.
<rule context="@when-iso">
<report role="warn" test=". = " sqf:fix="insert-todays-date insert-current-dateTime">@iso-when should not be
empty.</report>
<sqf:fix id="insert-todays-date">
<sqf:description>
<sqf:title>Insert today's date (ISO)</sqf:title>
</sqf:description>
<sqf:replace match="." target="when-iso" node-type="attribute">
<value-of select="current-date()"/>
</sqf:replace>
</sqf:fix>
<sqf:fix id="insert-current-dateTime">
<sqf:description>
<sqf:title>Insert today's date and time (ISO)</sqf:title>
</sqf:description>
<sqf:replace match="." target="when-iso" node-type="attribute">
<value-of select="current-dateTime()"/>
</sqf:replace>
</sqf:fix>
</rule>