<xsl:variable name="now" select="current-date()"/> <xsl:variable name="date-format" select="'[Y0001]-[M01]-[D01]T00:00:00'"/> <created date="{if (not($productInfo/InitialWebPublicationDate/@xsi:nil='true')) then format-date($productInfo/InitialWebPublicationDate, $date-format) else (format-date($now, $date-format))}"/>
As Ryan Dew commented there is a shorter way like below:
<created date="{if (not(nilled($productInfo/InitialWebPublicationDate))) then format-date($productInfo/InitialWebPublicationDate, $date-format) else (format-date($now, $date-format))}"/>
You might want to take a look at fn:nilled. http://www.w3.org/TR/xpath-functions/#func-nilled Keep up the posts. It is always great to see what other's are doing.
ReplyDeleteAnd again I thank you for any useful commments ;-)
ReplyDelete