General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Generate date at PDF output footer

  • itsme

    Generate date at PDF output footer

    Participants 2
    Replies 3
    Last Activity 13 years, 8 months ago

    Hi All!

    I would like to ask if it's possible to generate out the date in the footer when we publish out in PDF document? How do i go about doing this?

    Reply

    Chris

    Reply to: Generate date at PDF output footer

    Hi Itsme,

    XSL isn't very good at dates and times, so the nice people at http://www.exslt.org/ have created some XSL extension functions, including those for date and time. The DITA Open Toolkit already uses some of the exslt.org extension functions, so all you have to do is add the reference to the dates-and-times library, and then use the function.

    You'll need to modify your [customization]/fo/xsl/custom.xsl file:

    1. Add a refernce to the exslt.org dates-and-times library (changes in bold):


        xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”
        xmlns:fo=”http://www.w3.org/1999/XSL/Format”
        xmlns:exsl=”http://exslt.org/common”
        xmlns:opentopic=”http://www.idiominc.com/opentopic”
        xmlns:exslf=”http://exslt.org/functions”
        xmlns:opentopic-func=”http://www.idiominc.com/opentopic/exsl/function”
        extension-element-prefixes=”exsl date
        exclude-result-prefixes=”opentopic exslf opentopic-func”
        xmlns:date=”http://exslt.org/dates-and-times”
        version=”1.1″>

    2. Create a variable to be used by your footer template:



     

    3. Add the $footerDate variable to your footer template(s);
    e.g. for PDF3 (XMetaL Enhanced PDF), to change the footer on odd-numbered pages, you need to override the __body__odd__footer__* parameters from [customization]/fo/xsl/xm_static_content.xsl:



    1 1 1

    no-op

    This will put the string “2009-01-16T11:40:40-08:00” into your footer.

    For more info on the date functions, see:

    http://saxon.sourceforge.net/saxon6.5.3/extensions.html

    http://www.exslt.org/date/functions/date-time/index.html

    HTH,

    Chris

    Reply

    itsme

    Reply to: Generate date at PDF output footer

    Hi Chris!

    Thanks a lot! I'll try it out:)

    Regards,
    itsme

    Reply

    saumitra

    Reply to: Generate date at PDF output footer

    Hi Chris,
    Is it also possible to add total number of pages. I want to display “Page X of Y” in the header – is this doable?
    I am able to add Page X (using $xmPageNumber) but I am not aware of the variable for the total number of pages.
    Can you please help?
    Thanks,
    Sammy

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support