Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 18th, 2006, 08:52 AM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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






Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting currency drmacy BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 September 20th, 2007 04:59 PM
ADO2.6 currency formatting dgulliver VB How-To 2 October 31st, 2006 07:20 PM
Date Formatting MargateFan XSLT 3 August 30th, 2006 07:42 AM
Formatting currency chelechele JSP Basics 0 April 5th, 2005 06:00 PM
Formatting to a Date trekmp ADO.NET 2 March 16th, 2004 01:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.