Skip to content

Commit

Permalink
JSON-LD: allow datePublished <= dateModified
Browse files Browse the repository at this point in the history
This is needed when we have only one revhistory entry.
In such a case, there are no two dates as the first is also the last.
Therefore, the comparision should check for equal or smaller.
  • Loading branch information
tomschr committed May 8, 2024
1 parent 520e461 commit f4eb3c4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions suse2022-ns/xhtml/json-ld.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@
</xsl:choose>
</xsl:variable>

<xsl:message>DEBUG: compare=<xsl:value-of select="$compare"/>
<!--<xsl:message>DEBUG: compare=<xsl:value-of select="$compare"/>
candidate-modified="<xsl:value-of select="$candidate-modified"/>"
candidate-published="<xsl:value-of select="$candidate-published"/>"
modified=<xsl:value-of select="$date-modified"/> => <xsl:value-of select="$is-modified-valid"/>
Expand All @@ -793,13 +793,13 @@
<xsl:value-of select="$date-published"/> => <xsl:call-template name="validate-date">
<xsl:with-param name="date" select="$date-modified"></xsl:with-param>
</xsl:call-template>
</xsl:message>
</xsl:message>-->

<!-- TODO: compare the two dates
Condition: datePublished < dateModified
Condition: datePublished <= dateModified
-->
<xsl:choose>
<xsl:when test="$compare = -1"/><!-- This is the expected outcome. Do nothing. -->
<xsl:when test="$compare &lt;= 0"/><!-- This is the expected outcome. Do nothing. -->
<xsl:when test="$compare = 1">
<xsl:call-template name="log.message">
<xsl:with-param name="level">warn</xsl:with-param>
Expand Down Expand Up @@ -1135,4 +1135,4 @@
}<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>

0 comments on commit f4eb3c4

Please sign in to comment.