XSQL date and currency formatting

Hi,

The output from the following code works just fine but I was wondering how I would go about formatting the date to DD,MM,YYYY and the output of fine to a currency format (eg 26 becomes 26.00). The current output of both values look like this:
11/21/2005 0:0:0
874.5
My code is as follows:
XSQL Page:

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="a.xsl"?>
<page xmlns:xsql="urn:oracle-xsql" connection="myconnection">
<xsql:query>
SELECT m.Surname Member, b.Title Book, l.Loaned_Date + t.Loan_Length Due_Date, decode (fine_cost_sf(l.Loaned_Date, t.Loan_Length, t.Fine_Per_Day), 0, 'NONE',
fine_cost_sf(l.Loaned_Date, t.Loan_Length, t.Fine_Per_Day)) Fine
FROM Loan_Type t, Book b, Copy c, Member m, Loan l
WHERE m.Member_ID = l.Member_ID
AND l.type_ID = t.type_ID
AND l.copy_Id = c.copy_ID
AND c.ISBN = b.ISBN
AND l.Returned = 0
ORDER BY m.Member_ID
</xsql:query>
</page>

XSLT Page:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="page">
<html>
<head>
<link rel="stylesheet" type="text/css" href="global.css"/>
</head>
<body>
<table>
<tr>
<th>Member</th><th>Book</th><th>Due Date</th><th>Fine (#163;)</th>
</tr>
<xsl:apply-templates select="ROWSET/ROW"/>
</table>
</body>
</html>
</xsl:template>

<xsl:template match="ROW">
<tr>
<td>
<xsl:value-of select="MEMBER"/>
</td>
<td>
<xsl:value-of select="BOOK"/>
</td>
<td>
<xsl:value-of select="DUE_DATE"/>
</td>
<td>
<xsl:value-of select="FINE"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>

Any help would be most grateful. Thank you for your time
[2363 byte] By [cpb123] at [2007-11-19 19:48:08]
# 1 Re: XSQL date and currency formatting
http://www.w3schools.com/xsl/func_formatnumber.asp
<xsl:value-of select='format-number(FINE, "0.00")' />

Date is harder:
<xsl:value-of select="substring-before(substring-after(DUE_DATE,'/'),'/')"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="substring-before(DUE_DATE,'/')"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="substring-after(substring-after(substring-before(DUE_DATE,' '),'/'),'/')"/>

or you could use substring function. if your month and day output always outputs 2 digits, eg 01/09 for January 9th.
<xsl:value-of select="substring(DUE_DATE,4,2)"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="substring(DUE_DATE,1,2)"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="substring(DUE_DATE,7,4)"/>

Or if you can use an XSLT-SL library:
http://builder.com.com/5100-31-5075671.html
jkmyoung at 2007-11-10 3:27:07 >
# 2 Re: XSQL date and currency formatting
Thank you for your reply. I have used the format-number code that you gave me for the FINE field but for the date, I found another way of doing it:

<xsql:query date-format="E, d MMM yyyy">

Thanks again.
cpb123 at 2007-11-10 3:28:07 >