comparing strings and integers
Given 2007-07-25T01:00:00-06:00
I am trying to increase the time by one hour, and then extract the hour (minus the preceeding '0')
For example,
2007-07-25T01:00:00-06:00 would return 2
2007-07-25T11:00:00-06:00 would return 12
I am receiving an error with the following regex comparison:
matches($hour,(1[0-9]|2[0-9])
Error: Arithmetic operator is not defined for arguments of types (xs:string, xs:integer)
<xsl:function name="ercot:extract-hour">
<xsl:param name="date" as="xs:dateTime"/>
<xsl:variable name="increase" select="$date + $one-hour"/>
<xsl:variable name="hour"
select="format-dateTime($increase,'[h]')"/>
<xsl:value-of select="if (matches($hour,(1[0-9]|2[0-9]))
then $hour
else substring($hour,1,1) "/>
</xsl:function>
|