Solved

How can i print system date in my xsl fo document?

Posted on 2003-10-30
4
309 Views
Last Modified: 2013-11-18
How can i print system date in my xsl fo document?

i want to display system date in my xsl-fo document(i mean in pdf document).

i am using only xsl.
and a formatter from antenna house?

can anybody know me how can i display system date in my pdf document.

i can use java script also.


regards
vihar123
0
Comment
Question by:vihar123
  • 2
4 Comments
 
LVL 3

Expert Comment

by:evedder
ID: 9654357
I generate the xsl with fop (a framework of apache) and print the date like this...

// get the date and time of system
                      Calendar calendario = Calendar.getInstance();
                       String fecha =  calendario.getCalendar.DAY_OF_MONTH)         + "/" +
calendario.get(Calendar.MONTH) + "/" +
calendario.get(Calendar.YEAR) + ", " +
calendario.get(Calendar.HOUR_OF_DAY) + ":" +
calendario.get(Calendar.MINUTE);

 
//Print the variable fecha that contains the system date and time in the foot of the page

dos.writeBytes("<fo:static-content flow-name=\"pie_pagina\" >");
dos.writeBytes("<fo:table>");
dos.writeBytes("<fo:table-column column-Width=\"100mm\"/>");
dos.writeBytes("<fo:table-column column-width=\"95mm\"/>");
dos.writeBytes(" <fo:table-body>");
dos.writeBytes(" <fo:table-row>");
dos.writeBytes(" <fo:table-cell >");
dos.writeBytes("<fo:block font-weight=\"bold\" font-size=\"6pt\"  space-before.optimum=\"10pt\" text-align=\"start\">Fecha: " + fecha + "</fo:block>");                
dos.writeBytes(" </fo:table-cell >");
dos.writeBytes(" <fo:table-cell >");
dos.writeBytes(" <fo:block font-weight=\"bold\" font-size=\"6pt\"  space-before.optimum=\"10pt\" text-align=\"end\">Hoja <fo:page-number/> de <fo:page-number-citation ref-id=\"fin_docto\"/></fo:block>");              
dos.writeBytes("                                               </fo:table-cell >");
dos.writeBytes("                                   </fo:table-row>");
dos.writeBytes("                       </fo:table-body>");
dos.writeBytes("            </fo:table>");
dos.writeBytes("</fo:static-content>");

 


dos is a DataOutputStream

i hope it helps you!
0
 
LVL 3

Expert Comment

by:evedder
ID: 9654360
sorry for double comment, that is code in java
0
 
LVL 3

Expert Comment

by:makc
ID: 9680868
assuming xslt transforms xml into xhtml, dirty way to do it on the client site would be to put something like this

<SPAN ID=ABC></SPAN><SCRIPT>setTimeout("ABC.innerText=Date()",1000)</SCRIPT>

in the plase where you wand the date in your xslt.
0
 
LVL 2

Accepted Solution

by:
praveen79 earned 20 total points
ID: 9681388
Hi,

there are lot of ways for getting system date.

for example in ur xsl file:

<?xml version="1.0" encoding="UTF-16" ?>
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:sg="http://www.mtsite.com/XSL/Function">
<ms:script language="JScript" implements-prefix="sg">
<![CDATA[

function systemDate()
             {
            
        var d = new Date();
        var date;
        date = d.getFullYear() + '-' + (d.getMonth() + 1)  + '-' + d.getDate();
        return(date);      
               }
]]>
</ms:script>


and call it like form your template as:

<xsl:value-of select="sg:systemDate()" />


Hope it works.


kind regards
vihar


0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Menu Trouble 8 31
Website's Backend -- software used ? 2 85
Grunt No Clean Targets 6 61
Problem to picture file 3 42
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now