DITA and XMetaL Discussion

XMetaL Community Forum DITA and XMetaL Discussion displaying date output is generated

  • IF

    displaying date output is generated

    Participants 5
    Replies 6
    Last Activity 12 years, 2 months ago

    In XMetal 6.0, is there a way to display in the output (HTML or XMetal Enhanced PDF via Render XEP) the date/time on which the output was generated? Thanks.

    Reply

    Derek Read

    Reply to: displaying date output is generated

    The date and time of production can be viewed (in Adobe Reader anyway) by opening the Document Properties dialog. I assume what you really want is to include this information somewhere directly within the visible portion of the PDF (and HTML). Can you elaborate on where you want this information to appear and what date/time format you wish it to be in?

    Two different source for the date/time I can think of and it isn't clear which you want:

    1. Hard-code the date into your map (or topic) using the elements DITA provides for this, then adjust the DITA OT transformation to extract this information and place it in the location you wish it to appear in your output. Maybe something like this:



     

    date="2010-01-12"/>


     

    A date attribute is also present on the following elements:
    (this is the most likely one to use depending on what you are after)

    Note that and appear inside various elements that give more context, like , , etc.

    A year attribute is present on the following elements:

    2. Modify the DITA OT in some way to obtain the date/time from the system (and again, insert it into the document somewhere). This would better reflect the actual time of “printing”. There are apparently some extensions to XSLT that provide date and time functions, however, I have not used these. I'm not sure if they will work with all XSLT processors either.

    Reply

    IF

    Reply to: displaying date output is generated

    The scenario in option 1 is what I was thinking. So basically, my question becomes: how do I show the value of    in the PDF output?

    Thanks. Isabelle

    Reply

    Derek Read

    Reply to: displaying date output is generated

    There's not quite enough detail here to give you an explicit answer but one way to do this might be to define a new parameter:


       
           


       

    Then insert this where you want to insert it using $documentCreatedDate. So, for example, if you wanted to have this appear in even (page numbered) footers inside the document body you could redefine the other parameters that are defined for that purpose:

        1 1 1
       
        no-op
       

    If you were to put all of the code above into %appdata%SoftQuadXMetaL SharedDITA_OTdemoxmfoCustomizationfoxslcustom.xsl (which is where I would suggest you put any overrides) then you should see the value for the date attribute appear on evenly numbered pages inside the document “body” (as opposed to evenly numbered pages, or the TOC, Index, etc).

    Note that as written above the XPath is specific to DITA Maps and is not “specialization savvy”.

    If you want the value for this element's date attribute to show up on the cover page you could modify the xm_titlepage.xsl directly (or perhaps ideally, do an override like above, but instead to in which case you'd need to duplicate the entire template and then insert your new code into it).

    You would be inserting something like the following into that template where you want the new content to appear (possibly after the “for-each” that inserts the subtitle):


       
            Created:
           
       

    I've reused xsl:use-attribute-sets="xm.titlepage.subtitle" for the styling here so that a new one doesn't need to be made up. You could create your own or use another one that already exists if you need this text to be styled differently.

    Note that this XPath is specialization-savvy.

    Reply

    IF

    Reply to: displaying date output is generated

    Thanks for the very detailed answer.  I got this to work but best of all a light bulb went on and I finally understand how to make the rest of my required changes in order to get a PDF output I can live with.

    Reply

    IF

    Reply to: displaying date output is generated

    FYI –  to close the loop
    This is what I ended up doing for my draft documents:

    In the footer, I have added a date that indicates when the output was generated, as per the instructions in http://forums.xmetal.com/index.php/topic,150.0.html

    I also print the create date and revised dates found in the prolog of each topic using this template:

       
          Topic created on: 
       

       
       
        Revised on: 
       

       

     

    Reply

    gcrews

    Reply to: displaying date output is generated

    For a pdf we use  the EXSLT date and time functions.
    http://www.exslt.org/date/functions/time/index.html
    I think it takes a little bit to get it working.

    Reply

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

Lost Your Password?

Products
Downloads
Support