Skip to content

Instantly share code, notes, and snippets.

@markito
Created April 19, 2011 15:45
Show Gist options
  • Save markito/928536 to your computer and use it in GitHub Desktop.
Save markito/928536 to your computer and use it in GitHub Desktop.
xsd date fix for 12/31
<xsl:variable name="myYear" select="year-from-date(current-date())"/>
<xsl:choose>
<xsl:when test="/env:Body/rout:ISO8583_0100/ISO8583_0100_Request/bit_013 = 1231">
<top:transactionDate>
<xsl:choose>
<xsl:when test="concat(month-from-date(current-date()),day-from-date(current-date())) != 1231">
<xsl:variable name="fixYear" select="int($myYear - 1)"/>
<xsl:value-of select="concat(/env:Body/rout:ISO8583_0100/ISO8583_0100_Request/bit_013,$fixYear)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(/env:Body/rout:ISO8583_0100/ISO8583_0100_Request/bit_013,$myYear)"/>
</xsl:otherwise>
</xsl:choose>
</top:transactionDate>
</xsl:when>
<xsl:otherwise>
<top:transactionDate>
<xsl:value-of select="concat(/env:Body/rout:ISO8583_0100/ISO8583_0100_Request/bit_013,$myYear)"/>
</top:transactionDate>
</xsl:otherwise>
</xsl:choose>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment