I have a problem converting dates from XML document using XSLT 2.0.
In HTML doc my date must look as 15-12-2006 => 15 December 2006
I'm using XSLT function "format-date" but saxon9he ignores it.
XML code:
?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="test2.xsl" type="text/xsl" ?>
<catalog>
<book id="bk111">
<author>LALALALALALA</author>
<title>LALALALALLALALAL</title>
<genre>LALALLALALALAL</genre>
<publish_date>01-11-2011</publish_date>
<description>LALALLALA</description>
</book>
<book id="bk156">
<author>LALLALALA</author>
<title>LALALLALAL</title>
<genre>LALAL</genre>
<price>99.00</price>
<publish_date>02-09-2009</publish_date>
<description>LALALLALA</description>
</book>
<book id="bk132">
<author>LALLALALALALAL</author>
<title>LALAL</title>
<genre>LALALALA</genre>
<price>55.00</price>
<publish_date>06-12-2012</publish_date>
<description>LALLALALA</description>
</book>
</catalog>
XSLT code:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output method="html"></xsl:output>
<xsl:strip-space elements="*"></xsl:strip-space>
<xsl:param name="publish_date" as="xs:dateTime" />
<xsl:template match ="/" >
<html>
<head>
</head>
<body>
<div>
<table>
<tr>
</tr>
<xsl:apply-templates/>
</table>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="catalog">
<td><b>Author</b></td>
<td><b>Book name</b></td>
<td><b>Category</b></td>
<td><b>Publish Date</b></td>
<td><b>Price</b></td>
<td><b>Description</b></td>
<xsl:for-each select="book">
<xsl:sort select="price" data-type="number"/>
<tr>
<td><xsl:value-of select="author"/></td>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="genre"/></td>
<td><xsl:value-of select="publish_date"/></td>
<td><xsl:value-of select="price"/></td>
<td><xsl:value-of select="description"/></td>
</tr>
</xsl:for-each>
</xsl:template>
<xsl:template match="book/publish_date">
<xsl:variable name="isoDate"
select="concat(substring(., 7, 4), '-', substring(., 4, 2), '-', substring(., 1, 2))"/>
<xsl:copy>
<xsl:value-of select="format-date(xs:date ($isoDate), '[D] [MNn] [Y]')"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
in HTML output dates NOT converts!