Q:

xslt 1.0 to convert xs:date to a specific dateFormat DD-MON-YYYY

I am new to xslt. so this might be a basic question. I am trying to convert a date received in xs:date format to DD-MON-YYYY
input received is :
<tns:receivedDate>2017-06-27</tns:receivedDate>
Output expected
<tns:receivedDate>27-JUN-2017</tns:receivedDate>
Thanks in advance

A:

If you mean convert YYYY-MM-DD to DD-MMM-YYYY, try:
<xsl:template name="format-date">
    <xsl:param name="date"/>
    <!-- day -->
    <xsl:value-of select="substring($date, 9, 2)"/>
    <xsl:text>-</xsl:text>
    <!-- month -->
    <xsl:variable name="m" select="substring($date, 6, 2)"/>
    <xsl:value-of select="substring('JanFebMarAprMayJunJulAugSepOctNovDec', 3*($m - 1)+1, 3)"/>
    <xsl:text>-</xsl:text>
    <!-- year -->
    <xsl:value-of select="substring($date, 1, 4)"/>
</xsl:template>

Demo: https://xsltfiddle.liberty-development.net/94rmq7k

